Failed to resolve: com.android.xxx Add Google Maven repository and sync project

問題描述

運行程序出現這種錯誤,導致程序無法執行。

	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.gradleallprojects閉包中加上maven路徑:

	allprojects {
	    repositories {
	        jcenter()
	        maven {
	            url "https://maven.google.com"
	        }
	    }
	}

記住是在最外層的build.gradle,不是app下的build.gradle哦。



個人網站:分享客https://sharerdiary.com/
這個網站經常分享一些免費視頻、免費音樂、實用工具和各種福利,感興趣的朋友可以看看!

您的關注和點贊是我分享的動力,如有幫助請勿吝嗇!ヽ( ̄▽ ̄)ノ



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章