【问题标题】:Play Service granular dependency errorPlay Service 粒度依赖错误
【发布时间】:2014-12-20 10:06:47
【问题描述】:

我尝试为 Google Play Service 6.5.+ 使用新的 Granular Dependency

在我的 gradle 中我设置了:

dependencies {
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile 'com.google.maps.android:android-maps-utils:0.3'
    compile 'com.google.android.gms:play-services-base:6.5.87'
    compile 'com.google.android.gms:play-services-location:6.5.87'
    compile 'com.google.android.gms:play-services-maps:6.5.87'
}

但我得到了这个错误:

Error:Execution failed for task ':app:processDebugResources'.
Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0

我已经更新了所有 SDK。

使用此新功能的正确方法是什么? 谢谢。

已解决

问题是android-maps-utils已经有Play Service 6.5.+,所以报错。

【问题讨论】:

  • 冲突似乎发生在 android-maps-utils 库和任何 play-services 库之间。我不确定是否不再需要 android-maps-utils 或者某些东西是否被错误打包。

标签: android google-play-services android-gradle-plugin


【解决方案1】:

android-maps-utils 库当前 already includes Google Play 服务。您可以尝试以下方法之一:

  1. their issue tracker 上打开一个问题,以便他们适应或帮助您(这意味着其他人也会从中受益)。

  2. 试试这个,我还没有测试过,它可能不起作用!我还没有查看地图实用程序以了解它们实际使用的内容。

    compile('com.google.maps.android:android-maps-utils:0.3') {
        exclude group: 'com.google.android.gms'
    }
    

【讨论】:

  • 谢谢,您的解决方案部分有效,我打开了一个跟踪器问题。
  • 请在找到可行的解决方案后,编辑您的帖子并将其包含在其中,以便其他人可以从中获利。 :)
  • 能否发一下问题的链接?
【解决方案2】:

这显然是 maps-utils 库 0.3.4 版中的 fixed,但它要求我删除对 play-services-maps 和 play-services-location 的引用。我仍然可以使用播放服务和位置服务,所以我猜 maps-utils 已经包含了这些。 然后我的 gradle 文件只包含:

compile 'com.google.maps.android:android-maps-utils:0.3.4'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-26
    • 1970-01-01
    • 2014-12-13
    • 1970-01-01
    • 1970-01-01
    • 2017-12-26
    • 2017-01-10
    • 1970-01-01
    相关资源
    最近更新 更多