Play Service granular dependency error

不想你离开。 提交于 2020-01-01 08:51:31

问题


I try to use new Granular Dependency for Google Play Service 6.5.+

In my gradle I set:

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'
}

but I get back this error:

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

I've all SDK updated.

What's the correct way to use this new feature? Thanks.

SOLVED

The problem is that android-maps-utils already have the Play Service 6.5.+, so the error.


回答1:


The android-maps-utils library currently already includes the Google Play Services. You can try one of the following:

  1. Open an issue on their issue tracker so they adapt or help you out (which would mean others would benefit from it too).

  2. Try this, I haven't tested this and it might not work! I haven't looked into the maps utils to see what they actually use.

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



回答2:


This was apparently fixed in version 0.3.4 of the maps-utils library, but it required that I remove the references to play-services-maps and play-services-location. I am still able to use play services and location services, so I'm guessing the maps-utils already includes those. My gradle file then only contains:

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


来源:https://stackoverflow.com/questions/27402145/play-service-granular-dependency-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!