Cannot set the value of read-only property 'outputFile'多渠道打包和All flavors must now belong to a named

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” 即可
彼此交流,补充填坑,希望对你有所帮助。纸上得来终觉浅,书到用时方恨少。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值