I need to use some native libraries(.so) in my android project. According to some answers here in StackOverflow about this topic, I created a jniLibs
folder in app/src/main
and put there my files:
armeabi/my_lib.so
armeabi-v7a/my_lib.so
x86/my_lib.so
Then, in my activity class I use:
static {
System.loadLibrary("my_lib");
}
But when I run the app, an UnsatisfiedLinkError
exception is generated. If this is important to be noticed, I don't have an Android.mk file, and I haven't changed anything that has to do with this in my gradle
files. So, the only think I did is to copy-paste my .so
files in jniLibs
and to write the code above in my activity. So what might be the cause of this problem? Am I missing something?
EDIT
This is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
buildToolsVersion "23.0.3"
compileOptions.encoding = 'ISO-8859-1'
defaultConfig {
applicationId "my.package"
minSdkVersion 4
targetSdkVersion 4
ndk {
moduleName "my_so_lib"
}
}
sourceSets {
main {
jni.srcDirs = ["libs"]
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
debuggable true
}
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a', 'mips', 'armeabi'
universalApk false
}
}
}