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
Android - Play Sound on Button Click - Null Pointer Exception
How to Use Isineditmode() to See Layout with Custom View in the Editor
Best Way to Update Data with a Recyclerview Adapter
Onclick Not Triggered on Linearlayout with Child
How to Extract the Text from the Selected Item on the Listview
Android Locationmanager.Getlastknownlocation() Returns Null
Retrieve Large Blob from Android SQLite Database
Determining If an Activity Exists on the Current Device
Android Button Has Setontouchlistener Called on It But Does Not Override Performclick
Fileprovider Crash - Npe Attempting to Invoke Xmlresourceparser on a Null String
Adjust Layout When Soft Keyboard Is On
Play Rtsp Streaming in an Android Application
How to Disable Future Dates in Android Date Picker