生产应用名称如:ShareSdk-v3.0.1_20181226.apk
android.applicationVariants.all {
variant -> variant.outputs.each {
output ->def outputFile = output.outputFile
if (outputFile !=null && outputFile.name.endsWith('.apk')) {
// 这里修改apk文件名
// def fileName = "demo_${variant.productFlavors[0].name}-${defaultConfig.versionCode}- ${defaultConfig.versionName}-${releaseTime()}.apk"
def fileName ="ShareSdk" +"-v" + defaultConfig.versionName +"_" +new Date().format("yyyy-MM-dd") +".apk"
//def fileName = outputFile.name.replace("app", "${rootProject.ext.appName}-${releaseTime()}-${defaultConfig.versionCode}-${defaultConfig.versionName}")
output.outputFile =new File(outputFile.parent, fileName)
}
}
}
网友评论