Java.Lang.Unsatisfiedlinkerror: Dalvik.System.Pathclassloader

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader

Please note that there's a naming convention. Your lib needs to be called libexample.so .

LoadLibrary("example") will look for libexample.so.

The .so library needs to be inside the apk under the lib folder (since you are developing for Android, it needs to be under the lib/armeabi and lib/armeabi-v7a folders - why both folders ? some versions of Android look under lib/armeabi and some look under lib/armeabi-v7a ... se what works for you ).

Other things to look for :

  • make sure you compile for the correct architecture (if you compile for armeabi v5 it won't work on armeabiv7 or armeabiv7s ).

  • make sure your exported prototypes are used in the correct class (check the hello jni example. Your exposed functions need to look something like Java_mypackagename_myjavabridgeclass_myfunction).

For example the function Java_com_example_sample_hello will translate in the java class com.example.sample , function hello.

UnsatisfiedLinkError: dalvik.system.PathClassLoader

So this is the solution for UnsatisfiedLinkError for my case but I think it's general.

Put in gradle.properties this line

android.useDeprecatedNdk=true;

and in build.gradle this line in defaultConfig field

ndk {
abiFilters "armeabi", "armeabi-v7a"
}

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList

The .so files should be placed in app/src/main/jniLibs/ folder. In your case, it should be app/src/main/jniLibs/armeabi/libHelloJni.so.



Related Topics



Leave a reply



Submit