Cordova Android 库版本之间的冲突

Cordova Android conflict between library versions

我正在构建一个使用 2 个插件的 cordova 应用程序 aerogear push plugin and google-maps plugin

事实是 google 地图插件需要

而推送插件需要 com.google.android.gms:play-services:6.1.11 所以当我尝试构建应用程序时,gradle 抱怨:

Error: more than one library with package name 'com.google.android.gms'

这里是 gradle dependencies 的输出:

compile - Classpath for compiling the main sources.
+--- com.android.support:appcompat-v7:22.+ -> 22.2.1
|    \--- com.android.support:support-v4:22.2.1
|         \--- com.android.support:support-annotations:22.2.1
+--- org.jboss.aerogear:aerogear-android-core:2.1.0
+--- org.jboss.aerogear:aerogear-android-pipe:2.1.0
|    +--- org.jboss.aerogear:aerogear-android-core:2.1.0
|    \--- com.google.code.gson:gson:2.2.2
+--- org.jboss.aerogear:aerogear-android-push:2.2.0
|    +--- org.jboss.aerogear:aerogear-android-core:2.1.0
|    +--- org.jboss.aerogear:aerogear-android-pipe:2.1.0 (*)
|    +--- com.google.android.gms:play-services:6.1.11
|    \--- com.google.code.gson:gson:2.2.2
+--- com.google.android.gms:play-services-maps:7.8.0
|    \--- com.google.android.gms:play-services-base:7.8.0
|         \--- com.android.support:support-v4:22.2.0 -> 22.2.1 (*)
\--- com.google.android.gms:play-services-location:7.8.0
     +--- com.google.android.gms:play-services-base:7.8.0 (*)
     \--- com.google.android.gms:play-services-maps:7.8.0 (*)

摘自build.gradle

apply from: "org.jboss.aerogear.cordova.push/hellocordova-dependencies.gradle"
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile project(path: "CordovaLib", configuration: "debug")
    releaseCompile project(path: "CordovaLib", configuration: "release")
    compile ("com.google.android.gms:play-services-maps:7.8.0")
    compile ("com.google.android.gms:play-services-location:7.8.0")
    // SUB-PROJECT DEPENDENCIES END
}

我不知道如何处理这个版本冲突...有什么想法吗?

所以我终于明白了,我刚刚创建了 build-extras.gradle 并告诉 gradle 强制使用 7.8.0 版本:

configurations.all{
    resolutionStrategy{
        force ("com.google.android.gms:play-services:7.8.0")
    }
}