How Android Studio hits the jar pack
In eclipse we know how to export a project as a jar package for use by other projects.
Can be processed by changing gradle in as.
We create a new project Makejar, create a new modle-type for the library in the project
The app for our main project,librarydemo is the model we want to generate the jar package for.
Add for example the following code in Librarydemo:
task makeJar(type: Copy) { delete‘build/libs/mysdk.jar‘ from(‘build/intermediates/bundles/release/‘) into(‘build/libs/‘) include(‘classes.jar‘) rename (‘classes.jar‘‘mysdk.jar‘)}makeJar.dependsOn(build)//在终端运行生成JAR包// gradlew makeJar
In terminal, type Gradlew Makejar Enter to see, for example, the following see OK:
Of course in the main Projectapp build to increase the Librarydemo this dependent model:
dependencies { compile fileTree(dir‘libs‘, include: [‘*.jar‘]) ‘com.android.support:appcompat-v7:22.2.0‘ compile project(‘:librarydemo‘)}
How Android Studio hits the jar pack