Use so files in Android:
Do a PDF reading function, find an open source library, Mupdf. Download is compiled on-line so library, import into their own project time has been error Java.lang.UnsatisfiedLinkError:Couldn ' t load netplayerlibq:findlibrary returned NULL, The method in the so file could not be found. Looking for an afternoon, finally know the reason.
The naming conventions for methods in JNI are
1) Prefix: Java_
2) The fully qualified name of the class, delimited by an underscore (_): Com_lms_jni_jnitest
3) method Name: getteststring
The method naming is related to the package name, so when using the so library, the package name of the class that called the method is changed to the package name written in the so file. This is the simplest way. Of course, the best way to do this is to find the source project source cross-compiled into a so file containing our project package name.
Reference http://blog.csdn.NET/jiabailong/article/details/7986350
There are two ways to import so in Android Studio:
1. Place the so file in the Libs directory and add the following configuration to the app's Build.gradle
Sourcesets { main { = ['libs'] }}
The entire configuration file is as follows:
Android {compilesdkversion atbuildtoolsversion'19.1.0'Defaultconfig {ApplicationID"Com.hehe.itlms"minsdkversion thetargetsdkversion atVersioncode1Versionname"1.0.0"} buildtypes {release {minifyenabledtrue//whether to confuseProguardfiles Getdefaultproguardfile ('Proguard-android.txt'),'Proguard-rules.pro'}} sourcesets {main {jnilibs.srcdirs= ['Libs'] } }}
2. Compress all required. So files into a. zip file (the file directory structure in the ZIP is: lib/armeabi/*.so) Note that if such a path, lib do not write Libs Ah! Then rename the. zip file to the Armeabi.jar file (I'm using So.jar), add the jar package to the project's Libs file, and add Islibrary.
The final directory structure
Libs
^---|xxx.jar
^---|armeabi.jar
^---|lib
^---|armeabi
^---|xxx.so
How Android uses so files and imports so in Android studio