通过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.2.8'

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

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

其他回答

我也有同样的问题。

您应该在构建中添加一些依赖项。Gradle,就像这样

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libcocos2dx')
    compile 'com.google.firebase:firebase-ads:11.6.0'
// the key point line
    compile 'com.google.android.gms:play-services-auth:11.6.0'
}

检查是否也安装了“谷歌Repository”。如果没有,你还必须在你的SDK管理器中安装“谷歌资源库”。

还要注意可能有两个SDK安装-一个来自AndroidStudio,另一个可能是你自己安装的。最好将其合并到一个安装中—这是一个常见的陷阱—您在一个安装中安装了它,但在与另一个安装一起构建时它会失败。

添加这作为第二个参考,因为我有类似的问题.. 我必须明确地加上'。aar'作为as设置中的'Archives'类别下的注册文件类型。

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

除了安装存储库和SDK包之外,还应该注意版本号定期变化。此时,一个简单的解决方案是用加号(+)符号替换特定的版本号。

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

谷歌指令表明应该确保升级版本号,但是添加加号处理版本控制中的更改。还要注意,在Android Studio中构建时,当有新版本可用时,状态行中会出现一条消息。

你可以通过钻取正确的存储库路径来查看play服务的可用版本:

参考文献

该站点还提供了Eclipse和其他IDE的说明。