問題描述
運行程序出現這種錯誤,導致程序無法執行。
ERROR: Failed to resolve: com.android.support:appcompat-v7:26.1.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.android.support:design:26.1.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.android.support:recyclerview-v7:22.2.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.android.support:support-v4:21.0.3
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app
解決方法
在最外層build.gradle
的allprojects
閉包中加上maven
路徑:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
記住是在最外層的
build.gradle
,不是app下的build.gradle
哦。
個人網站:分享客(https://sharerdiary.com/)
這個網站經常分享一些免費視頻、免費音樂、實用工具和各種福利,感興趣的朋友可以看看!