The entire JNI directory is created in the app directory of the Android Studio (version 1.2.2) project, and the JNI directory writes android.mk, APPLICATION.MK, and various types of C + + and assembler source files. Then the same as the original, with the Ndk_build tool to compile, and then the tool will automatically generate the Libs directory, there are each of you in the APPLICATION.MK processor architecture specified so file.
If you are referring to a third party so, put the relevant files directly in the Libs directory
Then edit the Build.gradle file in the app directory to add the following code to it:
Sourcesets { main { jnilibs.srcdirs = [' Libs '] } }
The complete Build.gradle file is as follows:
Apply plugin: ' Com.android.application ' android {compilesdkversion buildtoolsversion ' 22.0.1 ' defaultconfig { ApplicationID "Com.qianmi.myapp" minsdkversion targetsdkversion versioncode 1 ver Sionname "1.0"} buildtypes {release {minifyenabled false proguardfiles Getdefaultpro Guardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}} lintoptions {disable ' invalidpackage ' } sourcesets {main {jnilibs.srcdirs = [' Libs '}}} packagingoptions {exclude ' Meta-inf/services/javax.annotation.processing.processor '}}dependencies {compile filetree (dir: ' Libs ', include: [' * . Jar ']) compile ' com.android.support:appcompat-v7:22.2.0 ' compile ' com.google.code.gson:gson:2.3 ' compile ' COM.MC xiaoke.volley:library:1.0.16 ' compile ' com.android.support:design:22.2.0 ' compile ' com.android.support:cardview-v7 : 22.2.0 ' compile ' com.android.support:recyclerview-v7:22.2.0 ' compile ' com.github.bumptech.glide:glide:3.6.0 ' compile ' Com.jakewharton: butterknife:7.0.1 '}
Copyright NOTICE: This article for Bo Master original article, reproduced please retain the source <a href=http://blog.csdn.net/offbye>http://blog.csdn.net/offbye</a>
Add JNI so files to the Android Studio Gradle Project