Add JNI so files to the Android Studio Gradle Project

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.