我正在构建一个使用2个插件aerogear push plugin和google-maps plugin的cordova应用。
事实是谷歌地图插件需要
com.google.android.gms:play-services-maps:7.8.0
com.google.android.gms:play-services-location:7.8.0
而推送插件需要com.google.android.gms:play-services:6.1.11
,所以当我尝试构建应用时,gradle抱怨:
错误:多个包含包名称的库' 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
}
我不知道如何处理这个版本冲突......有什么想法吗?
答案 0 :(得分:2)
所以我终于明白了,我刚刚创建了build-extras.gradle
并告诉gradle强制使用7.8.0版本:
configurations.all{
resolutionStrategy{
force ("com.google.android.gms:play-services:7.8.0")
}
}