Android Studio 3.0 升级编译错误分析
来源:互联网 发布:淘宝带图评价福利 编辑:程序博客网 时间:2024/06/11 06:37
今天Google推送了Android Studio 3.0的升级
升级完了以后,AS要求将
gradle tools升级到3.0.0
classpath 'com.android.tools.build:gradle:3.0.0'
gradle也升级到gradle-4.1-all.zip
升级完了以后,编译就出现各种问题
问题1
Error:(130, 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
原来用来重命名打包后的apk方法不能用了
原来的方法
variant.outputs[0].outputFile = new File(apkDir, filename)
要改成下面的方法 variant.outputs.all {output ->
outputFileName = filename
}
问题2
2. Error:Cannot choose between the following configurations of project :videoplayer: - debugApiElements - debugRuntimeElements - releaseApiElements - releaseRuntimeElements All of them match the consumer attributes: - Configuration 'debugApiElements': - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required. - Found org.gradle.api.attributes.Usage 'java-api' but wasn't required. - Configuration 'debugRuntimeElements': - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required. - Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required. - Configuration 'releaseApiElements': - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required. - Found org.gradle.api.attributes.Usage 'java-api' but wasn't required. - Configuration 'releaseRuntimeElements': - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required. - Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required.
以前Android Studio不会自动匹配Library中的BuildTypes
3.0以后 现在就可以自动匹配了(只要app选择了debug,后面会自动选中debug,release也是一样)
当然 需要注意的是 Library中需要添加buildTypes跟app的一样,
比如App中有 release debug debugTest
那么Library中也要有这3个
直接空着也没关系
问题3
如果你用了类似butterknife
需要做如下改动
project的build.gradle文件中删除
- classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’
module的build.gradle文件中删除
- apply plugin: ‘android-apt’
module的build.gradle文件中替换
//apt 'com.jakewharton:butterknife-compiler:8.4.0'annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
问题4
D:\Dev\android\workspace\xxxx\xxxx\videoui\build\intermediates\bundles\debug\res\values\values.xmlError:(84, 5) error: style attribute '@android:attr/windowEnterAnimation' not found.Error:(84, 5) error: style attribute '@android:attr/windowExitAnimation' not found.D:\Dev\android\workspace\xxxxx\xxxx\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xmlError:(2556) style attribute '@android:attr/windowEnterAnimation' not found.Error:(2557) style attribute '@android:attr/windowExitAnimation' not found.Error:failed linking references.Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for detailsError:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for detailsError:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for detailsError:Execution failed for task ':app:processDebugResources'.> Failed to execute aaptInformation:BUILD FAILED in 13sInformation:9 errorsInformation:0 warningsInformation:See complete output in console
解决办法:
在Project/gradle.properties中添加 android.enableAapt2=false
- Android Studio 3.0 升级编译错误分析
- Android Studio编译错误
- Android studio 编译错误
- Android studio 编译错误
- 升级到Android Studio 3.0遇到的几个错误
- 升级到Android Studio 3.0出现 aapt2错误
- android studio升级到3.0之后的一个运行错误
- android studio 升级3.0
- android studio 升级3.0
- android studio 编译调试 错误
- android studio 编译调试 错误
- android studio 编译调试 错误
- Android Studio 编译错误集锦
- android studio 编译错误sRGB
- Android Studio编译错误汇总
- android studio调试编译错误
- Android Studio 编译错误总结
- android studio 编译错误解决
- 笔记本电脑数据丢失怎么恢复
- kafaka模板推送
- jQuery选择器本质及使用技巧,三种$()__有用
- Linux: date 和 随机数
- 基于jQuery 各种表单取值折磨
- Android Studio 3.0 升级编译错误分析
- push本地代码到github出错
- Android Studio运行app到手机提示:"Application Installation Failed" (小米手机)
- 20171026笔记
- WSGI uWSGI uwsgi
- cocos2d 在mac上的运行流程
- 海量数据查询优化方法(二)
- 数据库事务
- sql常用(二)