问题
Currently i am working on Android NDK and successfully implementing C code in jni and calling c code using jni on android studio 1.5.
But now as per as my project requirement i am not using c code on my android project so i am using only .so shared library.
I got this link and used sqlcipher but still i don't have enough knowledge about how to add or call .so shared library.
Refer above link and example, update my project but following getting error
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.abc.xyz-2/lib/arm/libV1.so" has bad ELF magic
Problem:
How to call .so shared library from android.
How to include .so files on my project.
回答1:
Read first my answer here to add *.so libraries:
https://stackoverflow.com/a/33164947/3626214
And now, read here how to solve java.lang.UnsatisfiedLinkError: dlopen failed: on Android 6.X devices because you'll get an error on this devices when you add *.so libraries:
build.gradle
android
{
//23 or higher
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig
{
...
//important code, write API 22
targetSdkVersion 22
...
}
...
}
来源:https://stackoverflow.com/questions/38145641/how-to-use-c-lib-so-from-android