How to properly introduce so files in Android studio

Source: Internet
Author: User

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

Related Article

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.