Android Studio將library手動打成jar包
阿新 • • 發佈:2018-12-29
task clearJar(type:
Delete) {
delete 'build/libs/httputils.jar'
delete 'libs/httputils.jar'
}
//task makeJar(type: Copy) {
// from('build/intermediates/bundles/debug')
// into('libs/')
// include('classes.jar')
// rename('classes.jar', 'httputils.jar')
//}
//打包任務
task makeJar(type:org.gradle.api.tasks.bundling.Jar) {
//指定生成的jar名
baseName 'httputils'
//從哪裡打包class檔案
from('build/intermediates/classes/debug/com/zxxk/httputils')
//打包到jar後的目錄結構
into('com/zxxk/httputils/')
//去掉不需要打包的目錄和檔案
exclude('BuildConfig.class', 'R.class')
//去掉R$開頭的檔案
exclude{ it.name.startsWith('R$');}
}
makeJar.dependsOn(clearJar, build)
delete 'build/libs/httputils.jar'
delete 'libs/httputils.jar'
}
//task makeJar(type: Copy) {
// from('build/intermediates/bundles/debug')
// into('libs/')
// include('classes.jar')
// rename('classes.jar', 'httputils.jar')
//}
//打包任務
task makeJar(type:org.gradle.api.tasks.bundling.Jar) {
//指定生成的jar名
baseName 'httputils'
//從哪裡打包class檔案
from('build/intermediates/classes/debug/com/zxxk/httputils')
//打包到jar後的目錄結構
into('com/zxxk/httputils/')
//去掉不需要打包的目錄和檔案
exclude('BuildConfig.class', 'R.class')
//去掉R$開頭的檔案
exclude{ it.name.startsWith('R$');}
}
makeJar.dependsOn(clearJar, build)