Android SDK生成时,自定义文件名称,而非系统第一分配的app-release.apk

时间:2023-03-09 15:49:38
Android SDK生成时,自定义文件名称,而非系统第一分配的app-release.apk
    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变量即为新生成文件的名称,个人根据需要进行相应的修改!