Android studio 将第三方jar包打入module的jar包中

//将第三方jar包打包到将要打包的jar包中
task makeJar(type: Jar ) {
    def fileName = "JLSCJ_HB_CONSUME-server--${android.defaultConfig.versionName}-${releaseTime()}"
    archivesBaseName = fileName
    //编译完工程后module中的Java文件已经生成了包含class 的classes.jar包
    from(project.zipTree('build/intermediates/packaged-classes/release/classes.jar'))
    //将第三方jar包打包到将要打包的jar包中
    from(project.zipTree("build/intermediates/packaged-classes/release/libs/JlScjLib-1.0-v5-2020.03.20.jar"))
    from(project.zipTree("build/intermediates/packaged-classes/release/libs/netty-all-4.1.26.Final.jar"))
    destinationDir = file('build/libs')
}
makeJar.dependsOn(build)

你可能感兴趣的:(Android studio 将第三方jar包打入module的jar包中)