无法解决:com.android.support:appcompat-v7:27.+

时间:2018-03-18 22:27:13

标签: android intellij-idea

我尝试制作Android Project

我有

OS Windwows 10,
Intellige IDEA 2017.2
JDK jdk1.8.0_161
Android API 27 Platform
Gradle 4.6
Android SDK 25.5.2

已安装的软件包

enter image description here

enter image description here

enter image description here

创建模拟器

enter image description here

设置SDK

enter image description here

尝试制作项目

enter image description here

返回错误

Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:27.+
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile:C:/Server/Repositories/projects/MyApplication/app/build.gradle">Show in File</a>

如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

您需要将google maven添加到root build.gradle中,如下所示:

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

对于Gradle构建工具插件版本3.0.0,您可以使用google()存储库(更多内容迁移到Gradle 3.0.0的Android插件):

allprojects {
repositories {
    jcenter()
    google()
}
}

答案 1 :(得分:0)

只需点击此链接: https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0

  

重要:支持库现在可以通过Google获得   Maven存储库。您无需下载支持存储库   来自SDK Manager。有关详细信息,请参阅Support Library Setup

另一个选项(查看CommonsWare评论):Failed to resolve: com.android.support:appcompat-v7:27.+