转自http://blog.csdn.net/jackliao1/article/details/50353189
android {
....
}
task clearJar(type: Delete) {
delete 'build/outputs/yourjarname.jar'
}
task makeJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('build/outputs/')
include('classes.jar')
rename ('classes.jar', 'yourjarname.jar')
}
makeJar.dependsOn(clearJar, build)
//在终端执行生成JAR包
// gradlew makeJar
dependencies {
....
}
复制上面的task到Gradle中添加,编译即可在build/outputs/下生成对应的jar
http://blog.csdn.net/onlysnail/article/details/45123837