I believe a lot of friends in the use of Android Studio development, have encountered how to introduce third-party so file problems, but the third-party officials only give the ADT environment integration method.
In Android Studio, the default is to use the Gradle compilation method, which is not the same as ADT editing, so how should the so file be introduced?
It's actually very simple. Here is an example of integrating Jpush to see how the so file is introduced into the compilation environment, and eventually to JNI can call the so file directly.
First, set up the Libs directory in the root directory of our module and copy the so files from the Jpush Integration SDK into each of the following:
Apply plugin: ' Com.android.application ' android {compilesdkversion buildtoolsversion "21.1.0" Defa ultconfig {ApplicationID "Com.wujay.footerballstar" Minsdkversion 8 targetsdkversion 21 Versioncode 1 Versionname "1.0"} buildtypes {release {Runproguard false Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro '}} Task Nativelibstojar (type:zip, Description: "Create a jar archive of the native Libs") {Destina Tiondir file ("$projectDir/libs") baseName "native_libs2" extension "jar" from Filetree (dir: "Li BS ", include:" **/*.so ") into" Lib "} Tasks.withtype (Javacompile) {compiletask-Compil Etask.dependson (Nativelibstojar)} } dependencies {compile Filetree (dir: ' Libs ', include: [' *.jar ']) compile ' com.android.support:appcompat-v7: 21.0.0 ' Compile files (' Libs/jpush-sdk-release1.7.2.jar ') compile files (' Libs/umeng_sdk.jar ') compile files ( ' Libs/libammsdk.jar ')}
Original address: http://blog.csdn.net/wulianghuan/article/details/44567001
Reference: http://blog.csdn.net/asmcvc/article/details/24457677
Reference: http://ph0b.com/android-studio-gradle-and-ndk-integration/
Reference: http://www.sxt.cn/u/1/blog/7082
How to properly introduce so files in Android studio