博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{...
阅读量:7010 次
发布时间:2019-06-28

本文共 1137 字,大约阅读时间需要 3 分钟。

转载请标明出处:

在做多渠道打包的时候出现了这个错误,在高版本的gradle出现。

 

具体错误为: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.

我的代码为下:

 

这个在低版本的gradle是行得通的,但是高版本就不行。

高版本的应该这样:

buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),             'proguard-rules.pro'            applicationVariants.all { variant ->                variant.outputs.all { output ->                    def outputFile = output.outputFile                    if (outputFile != null && outputFile.name.endsWith('.apk')) {                        def fileName = "novel_v${defaultConfig.versionName}_${releaseTime()}_${variant.productFlavors[0].name}.apk"                        outputFileName = fileName                    }                }            }        }    }

variant.outputs.each改为variant.outputs.all

output.outputFile = new File(outputFile.parent, fileName)改为outputFileName = fileName

 

转载于:https://www.cnblogs.com/tangZH/p/10764568.html

你可能感兴趣的文章
意向锁
查看>>
线性规划
查看>>
常见错误分析-笔记
查看>>
P1256 显示图像(广搜)
查看>>
MongoDB(课时29 MapReduce)
查看>>
Slurm任务调度系统部署和测试(源码)(1)
查看>>
李超树详解
查看>>
怎样才是全能的程序员?
查看>>
with as的用法
查看>>
springboot oauth 鉴权之——授权码authorization_code鉴权
查看>>
〔池化纲领〕也及链表
查看>>
黑马程序员-蓝桥杯110问题练习
查看>>
AtCoder Beginner Contest 127 解题报告
查看>>
最大流EK算法
查看>>
在nuxt中引入Font Awesome字体图标库
查看>>
sql trace script
查看>>
程序员,请不要抢系统管理员的饭碗
查看>>
VCS双机由于ID冲突导致启动失败
查看>>
Windows 8上安装本地回环网卡
查看>>
修改计算机名的注意事项
查看>>