WARNING: API ‘variantOutput.getPackageApplication()‘ is obsolete and has been replaced with ‘variant.getPackageApplicationProvider()‘.
将代码
applicationVariants.all { variant ->
if (variant.buildType.name.equals(‘release‘)) {
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith(‘.apk‘)) {
outputFileName = "Terminator${defaultConfig.versionName}.apk"
}
}
} else if (variant.buildType.name.equals(‘debug‘)) {
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith(‘.apk‘)) {
outputFileName = "Terminator${defaultConfig.versionName}${versionNameSuffix}.apk"
}
}
}
}
改为
applicationVariants.all { variant ->
if (variant.buildType.name.equals(‘release‘)) {
variant.outputs.all { output ->
outputFileName = "Terminator${variant.versionName}_${releaseTime()}.apk"
// def outputFile = output.outputFile
// if (outputFile != null && outputFile.name.endsWith(‘.apk‘)) {
// outputFileName = "Terminator${defaultConfig.versionName}.apk"
// }
}
} else if (variant.buildType.name.equals(‘debug‘)) {
variant.outputs.all { output ->
outputFileName = "Terminator${variant.versionName}_${releaseTime()}.apk"
// def outputFile = output.outputFile
// if (outputFile != null && outputFile.name.endsWith(‘.apk‘)) {
// outputFileName = "Terminator${defaultConfig.versionName}${versionNameSuffix}.apk"
// }
}
}
}