There are several sources out there that say you should create a directory in src/main/ called jniLibs/armeabi and add your compiled .so file to this location. Then load your library using System.loadLibrary("nameOflib").
My issue is that when I define my function
public native long create();
create() gives the error:
Cannot resolve corresponding JNI function Java_com_brendan_myApplication_MainActivity_create. Reports native method declarations in Java where no corresponding JNI function is found in the project.
Any ideas?
Turns out I can still call the jni methods even though there is an error saying "Cannot resolve corresponding JNI function".
to solve that problem, just follow this steps and visit a link below:
Adding .so Library in Android Studio 1.0.2
- Create Folder "jniLibs" inside "src/main/"
- Put all your .so libraries inside "src/main/jniLibs" folder
- Folder structure looks like,
|--app:
|--|--src:
|--|--|--main
|--|--|--|--jniLibs
|--|--|--|--|--armeabi
|--|--|--|--|--|--.so Files- No extra code requires just sync your project and run your application.
Reference
https://github.com/commonsguy/sqlcipher-gradle/tree/master/src/mainFrom: How to include *.so library in Android Studio?
EDIT: I suppose that might not be problem with configuration, but with how you declare native method signatures in Android NDK
Check this link: What is the correct way to write native method signatures in Android NDK?
Hope it help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With