发布于 1年前

Android Gradle报错:Failed to resolve: com.google.android.gms:play-services:11.2.0

问题

更新com.google.android.gms:play-services到11.2.0后报错:

Error:(20, 10) Failed to resolve: com.google.android.gms:play-services:11.2.0
Install Repository and sync project
Show in File
Show in Project Structure dialog

build.gradle依赖包:

dependencies {
    compile 'com.google.android.gms:play-services:11.2.0'

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:25.3.1'
}

解决

Google Play services依赖包的仓库改为了maven.google.com。在build.gradle添加google maven仓库:

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

repositories {
  jcenter()
   google()
}
©2020 edoou.com   京ICP备16001874号-3