buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig getSigningConfig() applicationVariants.all { variant -> variant.outputs.each { output -> def newName = output.outputFile.name newName = newName.replace("app-release", "ZQUNYAN-release-" + "${variant.versionName}") output.outputFile = new File(output.outputFile.parent, newName) } } } }
在build.gradle文件中buildTypes节点下增加如上代码,其中newName变量即为新生成文件的名称,个人根据需要进行相应的修改!