Cannot set the value of read-only property ‘outputFile’ for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl. Open File
1.Cannot set the value of read-only property 'outputFile’
更新AS 3.0之后,出现Cannot set the value of read-only property ‘outputFile’报错,查询了文档才知道是用来打包后重命名的gradle出现了问题。
原来的打包名设置如下
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith(’.apk’)) {
output.outputFile = new File(outputFile.parent, “card.io-sample-app-KaTeX parse error: Expected 'EOF', got '}' at position 34: …") }̲ } …{variant.productFlavors[0].name}_v${variant.versionName}.apk”
}
}
关于flavorDimensions可查看官方文档
https://developer.android.google.cn/studio/build/build-variants.htm
2.ERROR: All flavors must now belong to a named flavor dimension
在defaultConfig中加入 flavorDimensions “versionCode” 即可
彼此交流,补充填坑,希望对你有所帮助。纸上得来终觉浅,书到用时方恨少。