播放服务粒度依赖性错误

Gio*_*rio 9 android google-play-services android-gradle-plugin

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

在我的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'
}
Run Code Online (Sandbox Code Playgroud)

但是我收回了这个错误:

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
Run Code Online (Sandbox Code Playgroud)

我已经更新了所有SDK.

使用这个新功能的正确方法是什么?谢谢.

解决了

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

ari*_*d3r 10

android-maps-utils图书馆目前已包含 Google Play服务.您可以尝试以下方法之一:

  1. 他们的问题跟踪器上打开一个问题,以便他们适应或帮助你(这也意味着其他人也会从中受益).

  2. 试试这个,我没有测试过这个,它可能不起作用!我没有查看地图工具,看看他们实际使用了什么.

    compile('com.google.maps.android:android-maps-utils:0.3') {
        exclude group: 'com.google.android.gms'
    }
    
    Run Code Online (Sandbox Code Playgroud)


sku*_*erk 5

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

compile 'com.google.maps.android:android-maps-utils:0.3.4'
Run Code Online (Sandbox Code Playgroud)