Android Studio Import Third Party library Y

Source: Internet
Author: User

One, import jar package

(1), copy the jar package you need, to the Lib folder in the app directory



(2), select the jar package you imported----> right----->add as Libaray




(3) The pop-up window will appear.


(4), click OK, and then wait a few minutes, your jar package appears under some sub-package, it means that you added success




Second, add the library file

(1), copy the library file you want to the app peer directory


(2), find the Settings.gradle in the app sibling directory, add the library file you want to introduce




(3), find the Build.gradle file in the app directory, add the file you introduced





I do not have a problem here, the Internet also said that this compile will error,


You must also add a Build.gradle file in the file directory you introduced, as follows

Buildscript {

repositories {

Mavencentral ()

}

dependencies {

Classpath ' com.android.tools.build:gradle:0.6.+ '

}

}

Apply plugin: ' Android-library '

repositories {

Mavencentral ()

}

Android {

Compilesdkversion 18

Buildtoolsversion "17.0.0"

Defaultconfig {

Minsdkversion 14

Targetsdkversion 18

}

sourcesets {

Main {

Manifest.srcfile ' Androidmanifest.xml '

Java.srcdirs = [' src ']

Resources.srcdirs = [' src ']

Aidl.srcdirs = [' src ']

Renderscript.srcdirs = [' src ']

}

}

}

dependencies {

Compile ' com.android.support:appcompat-v7:+ '

Compile files (' Libs/gson-2.2.4.jar ')

}

This is a post-compilation, and it can be an error.

In this case, you may need to modify the Androidmanifest.xml file in the Httpzoid directory may exist and the file in your project conflict or the version span is too large to cause the syntax error modification

After all these steps, you can basically succeed.







Android Studio Import Third Party library Y

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.