Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{...
转载请标明出处:https://www.cnblogs.com/tangZH/p/10764568.html
更多精彩文章:http://77blogs.com/?p=298
在做多渠道打包的时候出现了这个错误,在高版本的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
Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{...的更多相关文章
- Could not find property 'outputFile
* What went wrong: A problem occurred configuring project ':app'. > Could not find property 'outp ...
- Gradle sync failed: Cannot set the value of read-only property 'outputFile'
错误 Gradle sync failed: Cannot set the value of read-only property 'outputFile' 原因 gradle打包,自定义apk名称代 ...
- Android Studio 中修改Apk名称
修改生成的apk名称,并且使调试时也可以使用. 在app->build.gradle 中增加以下内容: android.applicationVariants.all { variant-> ...
- 升级到 Android Studio 3.0 + Gradle 4.1 遇到的一些坑及解决方案
问题一: Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkD ...
- Android Studio 3.0正式版填坑之路
原文:https://www.jianshu.com/p/9b25087a5d7d Android Studio 3.0启动图 序言 总看别人的文章,今天尝试着自己来写一篇.在逛论坛时候,无意间发 ...
- 浅谈Android Studio3.0更新之路(遇坑必入)
>可以参考官网设置-> 1 2 >> Fantasy_Lin_网友评论原文地址是:简书24K纯帅豆写的我也更新一下出处[删除]Fa 转自脚本之家 浅谈Android Studi ...
- Android gradle 相关配置
有时候我们需要重命名输出apk文件名,在Android studio 3.0以前我们是这样写的: applicationVariants.all { variant -> variant.out ...
- Android常见错误整理
1.当我new class的时候,提示以下错误: Unable to parse template "Class" Error message: This template did ...
- 升级到Android Studio3.x遇到的问题及解决方案
升级到Android Studio3.x遇到的问题及解决方案 转 https://www.2cto.com/kf/201711/695736.html 升级到Android Studio3.0遇到的问 ...
随机推荐
- bugku misc writeup(一个普通的压缩包)
这个题做了好几个小时,因为没有writeup,一点一点摸索,做题思路写出来给大家交流 首先这是一个zip.rar压缩包,下载下来第一步就是拖进hexeditor中观察,检查下文件的头尾结构是否有问题, ...
- 第六章——决策树(Decision Trees)
决策树是强大的,多功能的机器学习算法. 6.1 训练和可视化一个决策树 在iris数据集训练DecisionTreeClassifier: from sklearn.datasets import l ...
- jQuery学习之旅 Item8 DOM事件操作
1.jquery页面载入事件 1.传统加载事件 <body onload="函数名()"> 页面全部html和css代码加载完成之后再调用指定的onload函数 win ...
- AutoIT 测试GUI工具
今天听到同事提到AutoIT,可以用来测试GUI窗口.了解一下这个工具. 以下内容引自: http://www.jb51.net/article/14870.htm (此url非原出处,该博主未注明原 ...
- python高级编程1
1.如何在列表,字典,集合中根据条件筛选数据? 如: 过滤列表[3, 9, -1, 10, 20, -2...]中的负数 筛出字典{‘小明’:70, 'Jim':88,'Tom':98...}中值高于 ...
- linux.go
func LockFile(file *os.File) error { return syscall.Flock(int(file.Fd()), syscall.LOCK_EX) }
- linux学习笔记基础篇(一)
一.IP操作 1.临时修改IP ,执行命令 ifconfig 网卡名称 新ip :例如 ifconfg nescc 192.168.1.110 ,重启失效 2.重启网络 ,执行命令 syste ...
- QTTabBar
出处:https://www.mokeyjay.com/archives/1811
- 你不可不知的iOS与Android差异点!
1.运行机制的区别 Android:沙盒运行机制,采用真后台运行,将所有的应用都保存在RAM中,按home键,程序被挂在了后台,实际未退出,因程序在后台运行,所以可以收到推送消息,导致内存越用越低,越 ...
- 死磕 java集合之LinkedTransferQueue源码分析
问题 (1)LinkedTransferQueue是什么东东? (2)LinkedTransferQueue是怎么实现阻塞队列的? (3)LinkedTransferQueue是怎么控制并发安全的? ...