Android,一个具有旧 google 播放服务的图书馆与 google 地图发生冲突

Android, one library with old google play service conflicts with google maps

我正在为我的项目使用 asne google plus 库。它使用旧版本的 google 播放服务。

当我添加具有较新版本的 Google 地图时,gradle 构建失败并显示此消息:

Error:Execution failed for task ':app:processDebugResources'.
Error: more than one library with package name 'com.google.android.gms'

我的 app.gradle 中的依赖项:

compile 'com.github.asne:asne-googleplus:0.3.3'

compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'

当我这样asne时:

compile ('com.github.asne:asne-googleplus:0.3.3') {
  transitive = true
}

这个库变得不可见,我无法调用它的方法。

如何解决这个冲突?

您可以尝试只排除库的 google 依赖项:

compile ('com.github.asne:asne-googleplus:0.3.3') {
  exclude group: 'com.google.android.gms'
}

我建议你使用整个依赖

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

而不是将其拆分为 play-services-location:8.3.0 和 play-services-maps:8.3.0 等部分。 link 详细解释了原因。