[英]Android gradle failed to resolve core right after creating a androidx project
我正在 android studio 3.3 中使用 androidx 創建一個新的 android 項目,並且在創建項目后立即出現以下錯誤
ERROR: Failed to resolve: core
Affected Modules: app
ERROR: Failed to resolve: collection
Affected Modules: app
ERROR: Failed to resolve: annotation
Affected Modules: app
ERROR: Failed to resolve: lifecycle-common
Affected Modules: app
ERROR: Failed to resolve: core-common
Affected Modules: app
我已經下載了最新的谷歌支持存儲庫,gradle 4.10.1,gradle android tools 3.3.0,我還檢查了我對 maven.google.com 和 jcenter.bintary.com 的訪問,這很好。
我還清理了項目並重新啟動了 android studio,但沒有一個工作
我的依賴:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
和所有項目存儲庫:
google()
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()
不幸的是,錯誤不清楚,我不知道這是怎么回事,謝謝你的幫助
錯誤是由於 android studio 的默認 androidx 依賴項版本,我將我的依賴項更改為:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
它現在工作正常。 我從這里得到這些版本
我建議你改變這些
你用吧
implementation 'androidx.appcompat:appcompat:1.0.0'
改成
implementation 'androidx.appcompat:appcompat:1.+'
和
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
改成
androidTestImplementation 'androidx.test:runner:1.+'
我在我的 gradle 中更新了這 3 行
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.