问题描述
运行程序出现这种错误,导致程序无法执行。
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
哦。