I am trying to add an external library, Scandit. I keep getting this error:
java.lang.UnsatisfiedLinkError: Couldn\'t load scanditsdk-android-3.3.1 from
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a', 'armeabi'
universalApk false
}
}
I get this code from facebook fresco library
I think it's a problem of the new gradle build system. Try the solution of this answer. There is also a link to a google group discussion, that describes solution and the problems more detailed.
To use native-library (so files) You need to add some codes in the "build.gradle" file.
This code is for cleaing "armeabi" directory and copying 'so' files into "armeabi" while 'clean project'.
task copyJniLibs(type: Copy) {
from 'libs/armeabi'
into 'src/main/jniLibs/armeabi'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(copyJniLibs)
}
clean.dependsOn 'cleanCopyJniLibs'
I've been referred from the below. https://gist.github.com/pocmo/6461138
I had a libs folder in my project where i included external libraries added the line compile fileTree(dir: 'libs', include: '*.jar') into dependencies {} in the gradle's build file.
Then I made a lib folder and inside it an armeabi folder where I've inserted all the needed .so files. I then zipped the folder into a .zip (the structure inside the zip file is now lib/armeabi/*.so) I renamed the .zip file into armeabi.jar and added it to the libs folder as an external library.
You can add pre built *.so files in Android Studio using gradle 0.7.2+. First create the jniLibs at this location /app/src/main/ location and copy the all the folder with *.so files (armeabi, armeabi-v7a, mips, x86) in the jniLibs.