How Android Studio imports third-party libraries

Source: Internet
Author: User

Today, when importing third-party libraries, a series of errors occurred, documenting your experience.

1. The third-party *.jar or *.aar package is now placed in the/app/libs directory in the project. Then modify the project's

2. Modify project's Build.gradle in Allprojects =>repositories to set the import directory as follows

/**
*Adds an configures a repository which would look for dependencies in a number of local directories.
*/
Flatdir {
' Libs '
}

3. dependencies in module Build.gradle Add code to import a third-party package

Compile Filetree (Dir' Libs ',Include: [' *.jar '])
Compile' com.android.support:appcompat-v7:22.2.0 '
CompileName Android-volley-1.0.16-debug ', AAR")

The syntax format for importing AAR is < Span style= "color: #008000; Font-weight:bold; " >compile (name: "The third-party package file name is not good with extensions," Span style= "color: #008000;" >ext:

Import the syntax format of the jar package compile

Android Studio consists of two gradle profiles, one project is a module, project's gradle configuration file is used in the root directory of the project Build.gradle to configure the overall project, The configuration of the module's gradle is also called Build.gradle for importing third-party libraries in the app directory, with some additional configuration information (no detailed study)

.

How Android Studio imports third-party libraries

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.