Android Studio导出jar包

Android Studio导出jar包

1、修改bulid.gradle文件

apply plugin: 'com.android.library'

task deleteOldJar(type: Delete) {
    delete 'build/outputs/xxxx.jar'
}

task exportJar(type: Copy) {
    from('build/intermediates/bundles/release/')
    into('build/outputs/')
    include('classes.jar')
    rename ('classes.jar', 'xxxx.jar')
}

exportJar.dependsOn(deleteOldJar, build)

注: 其实as已经把jar生成到了

build/intermediates/bundles/release/classes.jar
build/intermediates/bundles/debug/classes.jar

2、打开gradle视图

View --- Tool Windows --- Gredle 
找到 ${对应的module} - Tasks - other - exportJar 双击运行即可

Android Studio导出jar包_第1张图片

Android Studio导出jar包_第2张图片

你可能感兴趣的:(android)