“Ionic上有多个包名为'com.google.android.gms'的图书馆。”

时间:2015-10-08 23:07:01

标签: android cordova ionic cordova-plugins android-build

我在尝试为Android构建我的离子应用程序时遇到错误。它抛出一个错误:Error: more than one library with package name 'com.google.android.gms',我无法弄清楚插件的组合是什么造成的。什么插件导致了这个问题,我该怎么办呢?谢谢!

ionic plugin list的输出:

cc.fovea.cordova.purchase 3.11.0 "Purchase"
com.google.playservices 21.0.0 "Google Play Services for Android"
com.ionic.keyboard 1.0.4 "Keyboard"
com.phonegap.plugins.PushPlugin 2.5.8 "PushPlugin"
com.phonegap.plugins.facebookconnect 0.11.2 "Facebook"
com.verso.cordova.clipboard 0.1.0 "Clipboard"
cordova-plugin-camera 1.2.0 "Camera"
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-crosswalk-webview 1.2.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-file 2.1.0 "File"
cordova-plugin-file-transfer 1.2.0 "File Transfer"
cordova-plugin-geolocation 1.0.1 "Geolocation"
cordova-plugin-google-analytics 0.8.0 "Google Universal Analytics Plugin"
cordova-plugin-inappbrowser 1.0.1-dev "InAppBrowser"
cordova-plugin-network-information 1.0.1 "Network Information"
cordova-plugin-splashscreen 2.0.1-dev "Splashscreen"
cordova-plugin-statusbar 1.0.1 "StatusBar"
cordova-plugin-whitelist 1.0.0 "Whitelist"
org.apache.cordova.globalization 0.3.4 "Globalization"
twitter-connect-plugin 0.4.0 "Twitter Connect"

2 个答案:

答案 0 :(得分:3)

呜!我能够解决它。

  1. 在与build.gradle相同的文件夹中创建build-extras.gradle文件。
  2. 填写:

    configurations { all*.exclude group: 'com.android.support', module: 'support-v4' all*.exclude group: 'com.google.android.gms', module: 'play-services-analytics' }

  3. 第二行与此错误有关,第一行修复了类似的问题。

答案 1 :(得分:0)

运行./gradlew :app:dependencies并查看正在使用com.google.android.gms的软件包。然后将其排除在一个或多个依赖项之外:

compile('some_package') {
    exclude group: 'com.google.android.gms', module: 'some_module'
}