Create a new Android project with the following project structure:
1, add the third-party library source code
First, the third-party class library is checked into the same directory as the app sibling:
After that, add the compiled code under Build.gradle (MOUDULE:APP): Add the import code in Setings.gradle
Add later (a new module can be added)
Then delete it, and the build.gradle of the third party will be generated automatically.
As below, it is done.
Apply plugin:'com.android.library'Android {compilesdkversion -buildtoolsversion"25.0.2"Defaultconfig {minsdkversion thetargetsdkversion -Versioncode1Versionname"1.0"Testinstrumentationrunner"Android.support.test.runner.AndroidJUnitRunner"} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile ('Proguard-android.txt'),'Proguard-rules.pro'}}}dependencies {compile filetree (include: ['*.jar'], dir:'Libs') Androidtestcompile ('com.android.support.test.espresso:espresso-core:2.2.2', {Exclude group:'Com.android.support', module:'support-annotations'}) Compile'com.android.support:appcompat-v7:25.1.0'Testcompile'junit:junit:4.12'Compile files ('Libs/ksoap2.jar')}
2. Import Jar Package
Put it directly in the App/libs directory and add the compiled code under Build.gradle (Moudule:app):
Or:
Select Right click to select Add as Libariy .... Can
The preceding line of code is automatically generated
Complete!
"Welcome to Reprint"
Reprint please indicate the source music study
Android Studio Import third-party class library source code and JAR package