![Android SDK生成时,自定义文件名称,而非系统第一分配的app-release.apk Android SDK生成时,自定义文件名称,而非系统第一分配的app-release.apk](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
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变量即为新生成文件的名称,个人根据需要进行相应的修改!