错误:(23,13)未能解析:com.google.android.gms:play services:11.2.0“;“安装存储库和同步项目”;不起作用

错误:(23,13)未能解析:com.google.android.gms:play services:11.2.0“;“安装存储库和同步项目”;不起作用,android,android-gradle-plugin,google-play-services,Android,Android Gradle Plugin,Google Play Services,我正在尝试在我的Android应用程序中获取服务器的位置和更新。 这是我的Gradle代码,这里我包括了编译'com.google.android.gms:play services:11.2.0'。这条线是: 但这是我得到的错误: Error:(23, 13) Failed to resolve: com.google.android.gms:play-services:11.2.0 Install Repository and sync project Show in File Show i

我正在尝试在我的Android应用程序中获取服务器的位置和更新。 这是我的Gradle代码,这里我包括了
编译'com.google.android.gms:play services:11.2.0'
。这条线是:

但这是我得到的错误:

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

单击“安装存储库和同步项目”不起作用。

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

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

尝试更新google play服务的新版本

  • 启动Android Studio
  • 在工具菜单上,单击Android>SDK管理器
  • 更新Android Studio SDK管理器:单击SDK工具,展开支持
  • 存储库,选择Google存储库,然后单击确定

  • build.gradle
    文件中:

    repositories {
        maven {
            url "https://maven.google.com"
        }
    }
    
    repositories {
        maven {
            url "https://maven.google.com"
        }
    }
    
    这里有同样的问题和更多的解决方案

    根据,依赖项现在可以从
    maven.google.com
    中找到