Android Studio报错:ERROR: Failed to resolve: com.android.support:appcompat-v7:28.0.+

Android Studio报错:ERROR: Failed to resolve: com.android.support:appcompat-v7:28.0.+


今天新导入一个Project项目,上来就报错找不到类库,Google狠起来自己的儿子都编译不过了么?吐血,如下:

ERROR: Failed to resolve: com.android.support:appcompat-v7:28.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:28.0.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app

尝试各种Clear、Rebuild无果后放弃了,还得去StackOverflow寻找良方,果然不负众望,找到了答案:
Failed to resolve: com.android.support:appcompat-v7:28.0
项目级Gradle中repositories的jcenter()下一行添加如下maven代码即可:

allprojects {
    repositories {
        jcenter()
        maven {// here we go!!
            url 'https://maven.google.com'
        }
    }
}

再编译,完美运行。

原来 Android Support Library dependencies 都是从 Android SDK Manager 里面下载的,现在新版本必须从 Google 的 Maven 仓库里面去下载。

你可能感兴趣的:(Android,Tools,and,IDE)