Android Studio3.0升級(jí)后使用注意事項(xiàng)及解決方法
Gradle plugin最高版本4.*
老的項(xiàng)目在使用新版本時(shí),可能會(huì)出現(xiàn)gradle plugin沖突的問題
Error:Failed to open zip file. Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network) Re-download dependencies and sync project (requires network)
解決方法:
去往gradle安裝目錄(File->Other Settings->Default Settings,然后可以搜索gradle,右側(cè)有Service directory path可以看到你gradle目錄),.gradle\wrapper\dists目錄下找到和項(xiàng)目的gradle-wrapper.properties里版本號(hào)一致的文件(比如gradle-3.3-all)刪除,重新編譯即可
Cannot choose between the following configurations,產(chǎn)生這個(gè)問題的原因是項(xiàng)目用引用了其他項(xiàng)目,比如compileproject(:library),
解決方法:
Android Studio3.0以后需要使用如下方式:
implementation project(path: ':library', configuration: 'default')
伴隨著 Android Gradle 插件 2.2 版本的發(fā)布,近期 android-apt 作者在官網(wǎng)發(fā)表聲明證實(shí)了后續(xù)將不會(huì)繼續(xù)維護(hù) android-apt,并推薦大家使用 Android 官方插件提供的相同能力。也就是說,大約三年前推出的 android-apt 即將告別開發(fā)者,退出歷史舞臺(tái),Android Gradle 插件提供了名為 annotationProcessor的功能來完全代替 android-apt,更換的步驟如下:
移除 Module 的 build.gradle 文件中對(duì) android-apt 的相關(guān)配置,也就是刪除類似下面的配置:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'com.neenbedankt.android-apt'
將 Module 的 build.gradle 文件中使用 apt 引入的依賴修改為使用 annotationProcessor 進(jìn)行引入,修改前配置如下:
dependencies {
compile 'com.google.dagger:dagger:2.0'
apt 'com.google.dagger:dagger-compiler:2.0'
}
修改后配置如下:
dependencies {
compile 'com.google.dagger:dagger:2.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
}
總結(jié)
以上所述是小編給大家介紹的Android Studio3.0升級(jí)后使用注意事項(xiàng),希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
- Android Studio 導(dǎo)入開源項(xiàng)目的正確姿勢及注意事項(xiàng)
- Android 程序執(zhí)行Linux命令的解決方法及注意事項(xiàng)
- 將Eclipse工程轉(zhuǎn)Android Studio工程的步驟與注意事項(xiàng)
- AndroidStudio升級(jí)到3.0的新特性和注意事項(xiàng)小結(jié)
- 詳解Android Service 使用時(shí)的注意事項(xiàng)
- Android 中ViewPager中使用WebView的注意事項(xiàng)
- Android TimerTask 的簡單應(yīng)用及注意事項(xiàng)
- Android 如何使用log4j及注意事項(xiàng)
- Android集成百度地圖開發(fā)流程和注意事項(xiàng)
- Android onNewIntent()觸發(fā)機(jī)制及注意事項(xiàng)
- Android Studio添加第三方庫的注意事項(xiàng)
- Android 程序申請(qǐng)權(quán)限注意事項(xiàng)
- Android Service自啟動(dòng)注意事項(xiàng)分析
- 關(guān)于Android WebView的loadData方法的注意事項(xiàng)分析
- Android NDK中socket的用法以及注意事項(xiàng)分析
- Android生存指南之:開發(fā)中的注意事項(xiàng)
- Android 編程下字庫的使用及注意事項(xiàng)
- 60條Android開發(fā)注意事項(xiàng)與經(jīng)驗(yàn)總結(jié)
相關(guān)文章
android第三方分享方式的簡單實(shí)現(xiàn)
這篇文章主要為大家詳細(xì)介紹了android第三方分享方式的簡單實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-10-10
保存ListView上次的滾動(dòng)條的位置實(shí)例(必看)
下面小編就為大家?guī)硪黄4鍸istView上次的滾動(dòng)條的位置實(shí)例(必看)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-03-03
Android NestedScrolling嵌套滾動(dòng)的示例代碼
這篇文章主要介紹了Android NestedScrolling嵌套滾動(dòng)的示例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-05-05
Android ListView數(shù)據(jù)綁定顯示的三種解決方法
本篇文章小編為大家介紹,Android ListView數(shù)據(jù)綁定顯示的三種解決方法。需要的朋友參考下2013-04-04
解決 INSTALL FAILED CONFLICTING PROVIDER的問題方法
這篇文章主要介紹了解決 INSTALL FAILED CONFLICTING PROVIDER的問題方法的相關(guān)資料,需要的朋友可以參考下2017-02-02
Android之Intent附加數(shù)據(jù)的兩種實(shí)現(xiàn)方法
這篇文章主要介紹了Android之Intent附加數(shù)據(jù)的兩種實(shí)現(xiàn)方法,以實(shí)例形式較為詳細(xì)的分析了添加數(shù)據(jù)到Intent的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-09-09
android播放視頻時(shí)在立體聲與單聲道之間切換無變化原因分析及解決
使用第三方視頻播放器,有立體聲與單聲道之間切換,發(fā)現(xiàn)切換后無作用,原因是由于在HAL層默認(rèn)沒有處理上層發(fā)的stereo 轉(zhuǎn)mono的命令,具體的解決方法如下2013-06-06
Android實(shí)現(xiàn)帶數(shù)字的圓形進(jìn)度條(自定義進(jìn)度條)
在項(xiàng)目開發(fā)中經(jīng)常遇到帶圓形進(jìn)度條的需求,在GitHub上逛了一圈,發(fā)現(xiàn)沒有,今天小編抽空給大家分享Android實(shí)現(xiàn)帶數(shù)字的圓形進(jìn)度條(自定義進(jìn)度條),需要的朋友參考下2017-02-02

