通过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)为什么旧版本消失了?


当前回答

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

其他回答

我也有同样的问题。

您应该在构建中添加一些依赖项。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'类别下的注册文件类型。

就我个人而言,这篇文章通过将谷歌()移到存储库的顶部帮助我解决了这个问题。

我也有同样的问题,但我已经解决了。

按照上面提到的别人的方法,我尝试了所有的方法,但并没有解决我的问题。

即使你有两个SDK位置,也不需要担心,检查你的android home是否设置为android studio SDK(如果你有android存储库和SDK位置中的所有东西)。

解决方案:

转到你的项目结构 选择你的模块 单击右侧的依赖项 添加库依赖 “com.google.android.gms: play-service: +”

我希望它能解决你的问题。