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