java.util.zip.ZipException:重复条目:com / google / android / gms / common / api / Api $ ApiOptions $ HasOptions.class

时间:2017-09-19 15:03:34

标签: android cordova google-analytics google-play-services

我无法为Android建立我的cordova项目。

安装的插件是

com.bez4pieci.cookies 0.0.1 "Cookies"
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-camera 2.3.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-cookieemperor 1.0.0 "CookieEmperor"
cordova-plugin-customurlscheme 4.2.0 "Custom URL scheme"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-file 2.1.0 "File"
cordova-plugin-file-transfer 1.2.1 "File Transfer"
cordova-plugin-google-analytics 0.8.1 "Google Universal Analytics Plugin"
cordova-plugin-googleplayservices 19.0.3 "Google Play Services for Android"
cordova-plugin-inappbrowser 1.6.1 "InAppBrowser"
cordova-plugin-network-information 1.0.1 "Network Information"
cordova-plugin-whitelist 1.0.0 "Whitelist"
cordova-plugin-zip 3.0.0 "cordova-plugin-zip"
cordova.plugins.diagnostic 2.3.17 "Diagnostic"
org.apache.cordova.statusbar 0.1.10 "StatusBar"
org.chromium.common 1.0.6 "Chrome Apps Common Utils"
org.ck12.identity 1.2.1 "Google Play Identity API"

build.gradle中添加的依赖项如下所示。

compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.android.support:customtabs:23.3.0"
compile "com.android.support:support-v4:24.1.1+"
compile "com.google.android.gms:play-services-analytics:+"
compile "com.android.support:support-v4:23.+"
compile "com.android.support:appcompat-v7:23.+"
// SUB-PROJECT DEPENDENCIES END

我在libs文件夹中也有一个名为google-play-services.zip的zip文件,它包含在编译文件树中

cordova版本7.0.1

2 个答案:

答案 0 :(得分:0)

您应该删除google-play-services.zip,因为它会在compile "com.google.android.gms:play-services-analytics:+"

中产生重复问题

如果你想要更多的goole play服务功能,你可以在build.gradle中明确添加它:

com.google.android.gms:play-services-maps:+
com.google.android.gms:play-services-location:+

并在multiDexEnabled true中添加build.gradle,如下所示

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14 //lower than 14 doesn't support multidex
             targetSdkVersion 22

             // Enabling multidex support.
             multiDexEnabled true
         }
}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
}

答案 1 :(得分:0)

就我而言,错误来自cordova平台android@6.3.0和cordova插件cordova-plugin-compat之间的组合,该组合已被弃用,并且在使用android@6.3.0 +构建时会产生问题。

希望它对某人有帮助。