错误:(23,13)无法解决:com.google.android.gms:play-services:11.2.0"安装存储库和同步项目"不起作用

Mah*_*lam 10 android google-play-services android-gradle-plugin

我想在我的Android应用中获取位置并更新到服务器.这是我的Gradle代码,这里包括我compile 'com.google.android.gms:play-services:11.2.0'.这一行来自文档:

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'       
}
Run Code Online (Sandbox Code Playgroud)

但这是我得到的错误:

Error:(23, 13) 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
Run Code Online (Sandbox Code Playgroud)

单击"安装存储库和同步项目"不起作用.

Sau*_*rat 29

将其添加到项目级build.gradle文件中:

repositories {
    maven {
        url "https://maven.google.com"
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 根据[Google Play服务发布说明](https://developers.google.com/android/guides/releases),现在可以从`maven.google.com获取依赖项 (4认同)