【问题标题】:Gradle unable to resolve Play services dependencyGradle 无法解决 Play 服务依赖
【发布时间】:2013-11-12 06:07:17
【问题描述】:

我有一个带有 Google Play services rev 的干净的 Android 项目。 13通过SDK管理器安装,关注these instructions。

我的build.gradle文件如下:

dependencies {
    compile 'com.google.android.gms:play-services:4.0.30'
}

但是,当我尝试构建这个应用程序时,我得到了

Gradle: A problem occurred configuring project ':Maple'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':Maple:_DebugCompile'.
      > Could not find com.google.android.gms:play-services:4.0.30.
        Required by:
            MapleProject:Maple:unspecified

【问题讨论】:

  • 从 cmd 输入“gradle clean cleaneclipse eclipse”
  • 您需要从 SDK 管理器的 extras 部分安装 google 存储库,才能让播放服务与 gradle 一起使用。

标签: android gradle android-studio


【解决方案1】:

在 SDK 管理器中安装 Google 存储库。

【讨论】:

  • +1 为什么 GCM 指南/文档中没有这个?浪费了我生命中的 3 个小时。
  • 我一直在为此烦恼,文档根本没有提到这一步。谢谢!
  • 更改版本对我有用。在同一线程中查看我的答案。
【解决方案2】:

即使您已在 SDK 管理器中安装了 Google Repository,您仍可能会看到相同的错误。

另一个可能的解决方案是降级您的版本。

例如,代替

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

做

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

Google 的Set up Google Play Services 页面上发布了通知 11.2.0,但它对我不起作用。

【讨论】:

    【解决方案3】:

    您是在 Avd 上进行测试(模拟器还是设备?) 如果是模拟器,请检查以下内容: 我通过创建一个目标版本为:Google APIs(GoogleInc) API Level 18 的新 avd 解决了这个问题。(需要平台 4.3 google api)

    【讨论】:

      猜你喜欢
      • 2019-05-20
      • 2015-05-10
      • 1970-01-01
      • 2017-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多