The ". So" library used in the Gradle schema
This address: Http://blog.csdn.net/caroline_wendy
Android uses the gradle architecture of Android applications, need to do special processing of . So library , because will not find, will lead to compile correct, use error; common usage is based on different CPUs, There are different libraries, including:armeabi,mips,x86 and so on.
Error:
Java.lang.UnsatisfiedLinkError:Couldn ' t load weibosdkcore from loader dalvik.system.pathclassloader[dexpathlist[[ Zip file "/data/app/xxx.apk"],nativelibrarydirectories=[/data/app-lib/xxx-2,/vendor/lib,/system/lib]]: Findlibrary returned null
There are two ways to solve this:1. Generate a jar for the ". So" libraryTo bring the jar into the project, you need to note the order of the directories:
-lib--armeabi---xxx.so
command:
Jar CVF Xxx_cpu.jar./lib
then load into the application, you can;
2. Using Gradle configurationWithin the scope of
android{} , add:
Noinspection All task Copynativelibs (type:copy) { //third party lib so from (new File (ProjectDir, ' Libs ') {include ' armeabi/*.so '} into new File (BuildDir, ' native-libs ') } Tasks.withtype (javacompile) { Compiletask- //noinspection all compiletask.dependson copynativelibs } //noinspection All Tasks.withtype (com.android.build.gradle.tasks.PackageApplication) { Pkgtask - Pkgtask.jnifolders = new hashset<file> () PkgTask.jniFolders.add (New File (BuildDir, ' native-libs ')) }
Yes , "
//noinspection All" can remove
warning.
The ". So" library used in the Android-gradle schema