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/)
这个网站经常分享一些免费视频、免费音乐、实用工具和各种福利,感兴趣的朋友可以看看!

您的关注和点赞是我分享的动力,如有帮助请勿吝啬!ヽ( ̄▽ ̄)ノ



你可能感兴趣的:(Android,Android,Studio,Android疑难杂症)