通过gradle引用play-services对我来说停止了工作-归结起来-甚至我最初用作参考的样本也停止了工作: https://plus.google.com/+AndroidDevelopers/posts/4Yhpn6p9icf

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':auth'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':auth:compile'.
      > Could not find com.google.android.gms:play-services:3.1.36.
        Required by:
            gpsdemos:auth:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.577 secs

我担心只是版本增加了,但这提出了两个问题: #1)新的是什么? #2)为什么旧版本消失了?


当前回答

我错误地添加了compile com.google.android.gms:play-services:5。+在构建脚本块中的依赖项。您应该在第二个依赖项块中添加它。做改变->同步项目与gradle。

其他回答

如果您已经安装了谷歌存储库,请确保更新了它。我必须更新我的谷歌存储库和服务。这是在我更新Android Studio之后。

我添加了一个新的环境变量ANDROID_HOME,并将其指向Android Studio安装目录中的SDK (C:\Program Files (x86)\Android\ Android - Studio \ SDK)。(环境变量是窗口的一部分;您可以通过先进的计算机属性访问它们……谷歌获取更多信息)

我错误地添加了compile com.google.android.gms:play-services:5。+在构建脚本块中的依赖项。您应该在第二个依赖项块中添加它。做改变->同步项目与gradle。

只需从sdk管理器中安装谷歌存储库,然后重新启动Android Studio。

我也有同样的问题,因为我有:

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

我解决了将版本号改为“+”。所以这些线必须是:

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