WARNING: API 'variantOutput.getPackageApplication()' is obsolete and has been replaced wit

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"
// }
}
}
}
上一篇:Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated


下一篇:java基础之I/O操作