Android Studio的Library項目一般默認(rèn)是生成aar文件,如何生成jar文件,其實也不難
兩步完成
1 在build.gradle中加入以下代碼
// This is the actual solution, as in http://stackoverflow.com/a/19037807/1002054task clearJar(type: Delete) { delete 'build/libs/myCompiledLibrary.jar'}task makeJar(type: Copy) { from('build/intermediates/bundles/release/') into('build/libs/') include('classes.jar') rename ('classes.jar', 'myCompiledLibrary.jar')}makeJar.dependsOn(clearJar, build)注意:classes.jar文件的路徑不一定是'build/intermediates/bundles/release/',這個根據(jù)實際情況來修改2 在Android Studio的Terminal中運行g(shù)radlew makeJar
新聞熱點
疑難解答
圖片精選