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