android.applicationVariants.all { variant ->android
variant.outputs.each { output ->app
def outputFile = output.outputFilegradle
if (outputFile != null && outputFile.name.endsWith('.apk')) {ui
// 這裏修改apk名稱spa
def fileName = outputFile.name.replace("app", "xxoo_${defaultConfig.versionName}.${defaultConfig.versionCode}_${releaseTime()}")get
output.outputFile = new File(outputFile.parent, fileName)it
}io
}配置
}file
Cannot set the value of read-only property 'outputFile’….
請嘗試下邊的操做方式:
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
// 這裏修改apk名稱
def fileName = outputFile.name.replace("app", "xxoo_${defaultConfig.versionName}.${defaultConfig.versionCode}_${releaseTime()}")
outputFileName = new File(outputFile.parent, fileName)
}
}
}