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


当前回答

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

其他回答

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

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

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

解决方案:

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

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

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

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

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

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

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

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

参考文献

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

我也有同样的问题。

您应该在构建中添加一些依赖项。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'
}