詳解升級(jí)Android Studio3.0時(shí)遇到的幾個(gè)問題
今天收到了Android Studio3.0更新推送,在升級(jí)過程中遇到幾個(gè)問題,在這里把問題和解決方法記錄下,方便要升級(jí)的童鞋。如果還有童鞋遇到不同的問題,也可以評(píng)論下我做下記錄
1.gradle打包,自定義apk名稱代碼報(bào)錯(cuò)(Cannot set the value of read-only property 'outputFile' )
報(bào)錯(cuò)
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>
解決 :修改文件名代碼請(qǐng)這樣寫
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "xinlebao_${defaultConfig.versionName}_${releaseTime()}.apk"
}
}
2. AAPT2 編譯報(bào)錯(cuò) AAPT2 error
報(bào)錯(cuò)
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
解決:在gradle.properties中關(guān)閉APPT2 編譯
android.enableAapt2=false
注:如果是eclipse轉(zhuǎn)到as上的項(xiàng)目,可能沒有g(shù)radle.properties文件,請(qǐng)?jiān)陧?xiàng)目根目錄中手動(dòng)創(chuàng)建
3.apt插件問題(Error:Cannot choose between the following configurations of project :mylibrary:)
報(bào)錯(cuò):
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的依賴,也要這樣更改
以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Android開發(fā)簽名知識(shí)梳理總結(jié)
這篇文章主要介紹了Android開發(fā)簽名知識(shí)梳理總結(jié),Android?系統(tǒng)要求所有?APK?必須先使用證書進(jìn)行數(shù)字簽名,然后才能安裝到設(shè)備上進(jìn)行更新2022-06-06
解析activity之間數(shù)據(jù)傳遞方法的詳解
本篇文章是對(duì)activity之間數(shù)據(jù)傳遞的方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-05-05
android 中 SQLiteOpenHelper的封裝使用詳解
這篇文章主要介紹了android 中 SQLiteOpenHelper的封裝使用詳解,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-02-02
Android控件Tween動(dòng)畫(補(bǔ)間動(dòng)畫)實(shí)現(xiàn)方法示例
這篇文章主要介紹了Android控件Tween動(dòng)畫(補(bǔ)間動(dòng)畫)實(shí)現(xiàn)方法,結(jié)合具體實(shí)例形式分析了Android補(bǔ)間動(dòng)畫的原理、功能實(shí)現(xiàn)與布局相關(guān)操作技巧,需要的朋友可以參考下2017-08-08
Kotlin ViewModelProvider.Factory的使用實(shí)例詳解
這篇文章主要介紹了Kotlin ViewModelProvider.Factory的使用,在我們使用 ViewModel 的時(shí)候,我們會(huì)發(fā)現(xiàn),有的時(shí)候我們需要用到 ViewModelFactory,有的時(shí)候不需要2023-02-02
完美解決android 項(xiàng)目jar包沖突的問題
這篇文章主要介紹了完美解決android 項(xiàng)目jar包沖突的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-03-03

