lintOptions { abortOnError false } task makeJar(type: Copy) { //刪除存在的 delete 'build/libs/myjar.jar' //設置拷貝的文件 打進jar包後的文件目錄 from('build/intermediates/packaged-classes/release/')into('build/libs/') //將classes.jar放入build/libs/目錄下 //include ,exclude參數來設置過濾 //(咱們只關心classes.jar這個文件) include('classes.jar') //重命名 rename ('classes.jar', 'myjar.jar') } makeJar.dependsOn(build)
在build.gradle配置如上信息gradle