Android Studio Imports third-party libraries, including the. So class

Source: Internet
Author: User

General Android projects from Eclipse to Android Studio (hereinafter referred to as), there will be a variety of problems, the most important is that "gradle" so far not supported. So library files packaged into the APK.
That is, if you are using a third-party library that contains. So files (typically libs\armeabi\ xxx.so), then just "system.loadlibrary" ("XXX") appears in the Code; When the code appears, it will definitely throw an exception unsatisfiedlinkerror here.

The solution is as follows: According to my Google for 2 days results, a more satisfactory and all the people who have this problem is feasible:
1) Create an empty folder "Lib" at any location on the hard disk (note that the name is "Lib" instead of "Libs")
2) Copy the Armeabi folder from the original Libs directory to the newly created Lib directory. (The. So file in the Armeabi folder will also be copied in)
3) package The newly created "Lib" directory into a. zip file and rename it "Armeabi.jar"
4) put Armeabi.jar into the original Libs directory (and other third-party jar packages)

After these 4 steps, it is OK to just re-update the third-party library under as.

Another method, copy the jar package to the Libs folder and view the open Module Settings Are they connected before

Set the following directly in the Build.gradle file in module:

dependencies {

compile filetree (dir:  ' Libs ' ' *.jar ' )

}

If it is a library of engineering class, put the project in the same directory as the main project and set it as below in the Build.gradle settings


Associating remote libraries

Compile ' com.github.project:2.2 '


Android Studio Imports third-party libraries, including the. So class

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.