详解升级Android Studio3.0时遇到的几个问题
作者:m1Ku 时间:2021-11-19 08:13:52
今天收到了Android Studio3.0更新推送,在升级过程中遇到几个问题,在这里把问题和解决方法记录下,方便要升级的童鞋。如果还有童鞋遇到不同的问题,也可以评论下我做下记录
1.gradle打包,自定义apk名称代码报错(Cannot set the value of read-only property 'outputFile' )
报错
Error:(56, 0) 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.
<a href="openFile:D:\eclipseCode\ipay-android\xinlebao\build.gradle" rel="external nofollow" >Open File</a>
解决 :修改文件名代码请这样写
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "xinlebao_${defaultConfig.versionName}_${releaseTime()}.apk"
}
}
2. AAPT2 编译报错 AAPT2 error
报错
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
解决:在gradle.properties中关闭APPT2 编译
android.enableAapt2=false
注:如果是eclipse转到as上的项目,可能没有gradle.properties文件,请在项目根目录中手动创建
3.apt插件问题(Error:Cannot choose between the following configurations of project :mylibrary:)
报错:
Error:Cannot choose between the following configurations of project :mylibrary:
- debugApiElements
- debugRuntimeElements
- releaseApiElements
- releaseRuntimeElements
All of them match the consumer attributes:
解决
//1.在project的build.gradle中删除
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
//2.在module的build.gradle中删除
apply plugin: 'android-apt'
//3.将module的build.gradle文件中的dependency
apt 'com.jakewharton:butterknife-compiler:8.1.0'
//改为
annotationProcessor 'com.jakewharton:butterknife-compiler:8.1.0'
其他使用apt的依赖,也要这样更改
来源:http://www.jianshu.com/p/9af06314e036
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Java实现聊天机器人完善版
![](https://img.aspxhome.com/file/2023/2/72902_0s.png)
Java+MySQL 图书管理系统
![](https://img.aspxhome.com/file/2023/7/60757_0s.png)
Mybatis批量操作sql写法示例(批量新增、更新)
![](https://img.aspxhome.com/file/2023/8/78878_0s.png)
Java8内存模型PermGen Metaspace实例解析
![](https://img.aspxhome.com/file/2023/8/59968_0s.jpg)
eclipse中maven插件安装教程
![](https://img.aspxhome.com/file/2023/2/62972_0s.png)
Java实现五子棋游戏
Mybatis中Mapper映射文件使用详解
![](https://img.aspxhome.com/file/2023/4/76244_0s.png)
Java实现FTP批量大文件上传下载篇2
![](https://img.aspxhome.com/file/2023/3/83123_0s.jpg)
maven scope provided和runtime的例子说明
![](https://img.aspxhome.com/file/2023/5/88075_0s.jpg)
SpringBoot 实现自定义的 @ConditionalOnXXX 注解示例详解
![](https://img.aspxhome.com/file/2023/3/62743_0s.jpg)
java操作Apache druid的实例代码
SpringBoot使用注解进行分页的实现示例
![](https://img.aspxhome.com/file/2023/3/75473_0s.jpg)
monkeyrunner之电脑安装驱动(5)
![](https://img.aspxhome.com/file/2023/4/87334_0s.png)
IDEA最新版2020.1的maven工程本地依赖仓库无法使用问题(已解决)
![](https://img.aspxhome.com/file/2023/1/60831_0s.png)
详解SpringBoot中如何使用布隆过滤器
Java枚举类用法实例
Java异常处理try catch的基本使用
使用java实现猜拳小游戏
![](https://img.aspxhome.com/file/2023/4/79224_0s.jpg)
一篇文章带你深入了解Java基础(2)
![](https://img.aspxhome.com/file/2023/1/81991_0s.jpg)