将 Google Play 服务添加到 gradle(Android Studio)不起作用

Adding Google Play Services to gradle (Android Studio) does not work

我有以下问题:

我在 Android Studio 中将 Google Play Servicesv27.0.0 安装到我的 SDK

之后,我将编译依赖项添加到 build.gradle(app 文件夹):

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.google.android.gms:play-services:27.0.0'
}

但是当我尝试将项目与 Gradle 同步时,我收到此错误消息:

Error:(25, 13) Failed to resolve: com.google.android.gms:play-services:27.0.0

我不知道该怎么办...

我认为不存在版本 27.0.0,最新版本是 8.1.0

有一种技巧可以用于任何依赖项。
您知道依赖项的名称,让我们考虑 com.google.android.gms:play-services:

首先,你需要使用这个表达式

  compile 'com.google.android.gms:play-services:+'

注意加号。比您单击 Sync Now 同步 gradle。之后你会看到 IDE 建议你不要使用 + 号。
但现在您可以使用组合 Alt+Enter 和 select Replace with specific version.
现在 + 号将替换为该库的最新可用版本。

利润。