当前位置: 首页 > 知识库问答 >
问题:

在这种情况下如何解析java.util.zip.ZipException?

单于轶
2023-03-14
Error:Execution failed for task ':app:transformClassesWithJarMergingForProdRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zzd.class

这是我的建筑。格雷德尔:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    jcenter()
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    maven { url "http://pyze.bintray.com/pyze-android" }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url 'https://jitpack.io' }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "myapp"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled = true
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile ('com.android.support:design:25.3.1')

    compile('com.jakewharton:butterknife:8.5.1')
    compile('com.squareup.okhttp3:logging-interceptor:3.3.0')
    compile('com.squareup.retrofit2:retrofit:2.1.0')
    compile('com.squareup.retrofit2:converter-gson:2.1.0')
    compile('com.squareup.okhttp:okhttp:2.2.0')
    compile('com.squareup.okhttp:okhttp-urlconnection:2.2.0')
    compile('com.squareup.picasso:picasso:2.4.0')
    compile('net.danlew:android.joda:2.9.4.2')
    compile('com.michaelpardo:activeandroid:3.1.0-SNAPSHOT')
    compile('com.github.jkwiecien:EasyImage:2.0.2')
    compile('com.journeyapps:zxing-android-embedded:3.5.0')
    compile('com.pyze:PyzeLibrary:2.12.0')

    compile 'io.intercom.android:intercom-sdk-base:3.2.0'
    compile 'io.intercom.android:intercom-sdk-fcm:3.2.0'
    compile('com.facebook.android:facebook-android-sdk:4.22.0')
    compile('com.digits.sdk.android:digits:2.0.6@aar') {
        transitive = true;
    }
    compile('com.twitter.sdk.android:twitter:2.3.2@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }
    compile('com.twitter.sdk.android:tweet-composer:2.3.1@aar') {
        transitive = true;
    }

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    annotationProcessor('com.jakewharton:butterknife-compiler:8.5.1')
}

apply plugin: 'com.google.gms.google-services'

我试图找出问题所在,使用以下代码来分析问题:

./gradlew clean app:dependencies

结果是:

compile - Classpath for compiling the main sources.
+--- com.android.support:multidex:1.0.1
+--- com.android.support:appcompat-v7:25.3.1
|    +--- com.android.support:support-annotations:25.3.1
|    +--- com.android.support:support-v4:25.3.1
|    |    +--- com.android.support:support-compat:25.3.1
|    |    |    \--- com.android.support:support-annotations:25.3.1
|    |    +--- com.android.support:support-media-compat:25.3.1
|    |    |    +--- com.android.support:support-annotations:25.3.1
|    |    |    \--- com.android.support:support-compat:25.3.1 (*)
|    |    +--- com.android.support:support-core-utils:25.3.1
|    |    |    +--- com.android.support:support-annotations:25.3.1
|    |    |    \--- com.android.support:support-compat:25.3.1 (*)
|    |    +--- com.android.support:support-core-ui:25.3.1
|    |    |    +--- com.android.support:support-annotations:25.3.1
|    |    |    \--- com.android.support:support-compat:25.3.1 (*)
|    |    \--- com.android.support:support-fragment:25.3.1
|    |         +--- com.android.support:support-compat:25.3.1 (*)
|    |         +--- com.android.support:support-media-compat:25.3.1 (*)
|    |         +--- com.android.support:support-core-ui:25.3.1 (*)
|    |         \--- com.android.support:support-core-utils:25.3.1 (*)
|    +--- com.android.support:support-vector-drawable:25.3.1
|    |    +--- com.android.support:support-annotations:25.3.1
|    |    \--- com.android.support:support-compat:25.3.1 (*)
|    \--- com.android.support:animated-vector-drawable:25.3.1
|         \--- com.android.support:support-vector-drawable:25.3.1 (*)
+--- com.android.support:design:25.3.1
|    +--- com.android.support:support-v4:25.3.1 (*)
|    +--- com.android.support:appcompat-v7:25.3.1 (*)
|    +--- com.android.support:recyclerview-v7:25.3.1
|    |    +--- com.android.support:support-annotations:25.3.1
|    |    +--- com.android.support:support-compat:25.3.1 (*)
|    |    \--- com.android.support:support-core-ui:25.3.1 (*)
|    \--- com.android.support:transition:25.3.1
|         +--- com.android.support:support-annotations:25.3.1
|         \--- com.android.support:support-v4:25.3.1 (*)
+--- com.jakewharton:butterknife:8.5.1
|    +--- com.jakewharton:butterknife-annotations:8.5.1
|    |    \--- com.android.support:support-annotations:25.1.0 -> 25.3.1
|    +--- com.android.support:support-annotations:25.1.0 -> 25.3.1
|    \--- com.android.support:support-compat:25.1.0 -> 25.3.1 (*)
+--- com.squareup.okhttp3:logging-interceptor:3.3.0
|    \--- com.squareup.okhttp3:okhttp:3.3.0
|         \--- com.squareup.okio:okio:1.8.0
+--- com.squareup.retrofit2:retrofit:2.1.0
|    \--- com.squareup.okhttp3:okhttp:3.3.0 (*)
+--- com.squareup.retrofit2:converter-gson:2.1.0
|    +--- com.squareup.retrofit2:retrofit:2.1.0 (*)
|    \--- com.google.code.gson:gson:2.7
+--- com.squareup.okhttp:okhttp:2.2.0
|    \--- com.squareup.okio:okio:1.2.0 -> 1.8.0
+--- com.squareup.okhttp:okhttp-urlconnection:2.2.0
|    \--- com.squareup.okhttp:okhttp:2.2.0 (*)
+--- com.squareup.picasso:picasso:2.4.0 -> 2.5.2
+--- net.danlew:android.joda:2.9.4.2
|    \--- joda-time:joda-time:2.9.4
+--- com.michaelpardo:activeandroid:3.1.0-SNAPSHOT
+--- com.github.jkwiecien:EasyImage:2.0.2
|    +--- com.android.support:appcompat-v7:25.0.0 -> 25.3.1 (*)
|    \--- com.jakewharton.timber:timber:4.4.0
+--- com.journeyapps:zxing-android-embedded:3.5.0
|    +--- com.google.zxing:core:3.3.0
|    \--- com.android.support:support-v4:25.1.0 -> 25.3.1 (*)
+--- com.pyze:PyzeLibrary:2.12.0
|    +--- com.android.support:appcompat-v7:23.1.1 -> 25.3.1 (*)
|    +--- com.google.android.gms:play-services-gcm:9.6.1
|    |    +--- com.google.android.gms:play-services-base:9.6.1
|    |    |    +--- com.google.android.gms:play-services-basement:9.6.1 -> 10.2.1
|    |    |    |    \--- com.android.support:support-v4:24.0.0 -> 25.3.1 (*)
|    |    |    \--- com.google.android.gms:play-services-tasks:9.6.1 -> 10.2.1
|    |    |         \--- com.google.android.gms:play-services-basement:10.2.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:9.6.1 -> 10.2.1 (*)
|    |    \--- com.google.android.gms:play-services-iid:9.6.1
|    |         +--- com.google.android.gms:play-services-base:9.6.1 (*)
|    |         \--- com.google.android.gms:play-services-basement:9.6.1 -> 10.2.1 (*)
|    +--- com.google.android.gms:play-services-ads:9.6.1
|    |    +--- com.google.android.gms:play-services-ads-lite:9.6.1
|    |    |    \--- com.google.android.gms:play-services-basement:9.6.1 -> 10.2.1 (*)
|    |    +--- com.google.android.gms:play-services-base:9.6.1 (*)
|    |    +--- com.google.android.gms:play-services-clearcut:9.6.1
|    |    |    +--- com.google.android.gms:play-services-base:9.6.1 (*)
|    |    |    \--- com.google.android.gms:play-services-basement:9.6.1 -> 10.2.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:9.6.1 -> 10.2.1 (*)
|    |    \--- com.google.android.gms:play-services-gass:9.6.1
|    |         \--- com.google.android.gms:play-services-basement:9.6.1 -> 10.2.1 (*)
|    +--- com.google.firebase:firebase-messaging:9.6.1 -> 10.2.1
|    |    +--- com.google.android.gms:play-services-basement:10.2.1 (*)
|    |    +--- com.google.firebase:firebase-iid:10.2.1
|    |    |    +--- com.google.android.gms:play-services-basement:10.2.1 (*)
|    |    |    \--- com.google.firebase:firebase-common:10.2.1
|    |    |         +--- com.google.android.gms:play-services-basement:10.2.1 (*)
|    |    |         \--- com.google.android.gms:play-services-tasks:10.2.1 (*)
|    |    \--- com.google.firebase:firebase-common:10.2.1 (*)
|    \--- com.android.support:support-v4:23.1.1 -> 25.3.1 (*)
+--- io.intercom.android:intercom-sdk-base:3.2.0
|    +--- com.android.support:design:25.3.1 (*)
|    +--- com.android.support:appcompat-v7:25.3.1 (*)
|    +--- com.android.support:animated-vector-drawable:25.3.1 (*)
|    +--- com.android.support:support-vector-drawable:25.3.1 (*)
|    +--- com.android.support:support-v4:25.3.1 (*)
|    +--- com.android.support:support-annotations:25.3.1
|    +--- com.android.support:recyclerview-v7:25.3.1 (*)
|    +--- com.intercom:android-composer:1.0.2
|    \--- com.intercom:android-composer-gallery:1.0.2
|         \--- com.android.support:appcompat-v7:25.1.1 -> 25.3.1 (*)
+--- io.intercom.android:intercom-sdk-fcm:3.2.0
|    +--- io.intercom.android:intercom-sdk-base:3.2.0 (*)
|    \--- com.google.firebase:firebase-messaging:10.2.1 (*)
+--- com.facebook.android:facebook-android-sdk:4.22.0
|    +--- com.android.support:support-v4:25.0.0 -> 25.3.1 (*)
|    +--- com.android.support:appcompat-v7:25.0.0 -> 25.3.1 (*)
|    +--- com.android.support:cardview-v7:25.0.0
|    |    \--- com.android.support:support-annotations:25.0.0 -> 25.3.1
|    +--- com.android.support:customtabs:25.0.0
|    |    +--- com.android.support:support-compat:25.0.0 -> 25.3.1 (*)
|    |    \--- com.android.support:support-annotations:25.0.0 -> 25.3.1
|    \--- com.parse.bolts:bolts-android:1.4.0
|         +--- com.parse.bolts:bolts-tasks:1.4.0
|         \--- com.parse.bolts:bolts-applinks:1.4.0
|              \--- com.parse.bolts:bolts-tasks:1.4.0
+--- com.digits.sdk.android:digits:2.0.6
|    +--- com.squareup.retrofit2:retrofit-mock:2.0.2
|    |    \--- com.squareup.retrofit2:retrofit:2.0.2 -> 2.1.0 (*)
|    +--- com.twitter.sdk.android:twitter-core:2.3.0 -> 2.3.1
|    |    +--- com.google.code.gson:gson:2.6.1 -> 2.7
|    |    +--- com.squareup.retrofit2:converter-gson:2.0.2 -> 2.1.0 (*)
|    |    +--- com.squareup.okhttp3:okhttp:3.2.0 -> 3.3.0 (*)
|    |    +--- io.fabric.sdk.android:fabric:1.3.+ -> 1.3.16
|    |    \--- com.squareup.retrofit2:retrofit:2.0.2 -> 2.1.0 (*)
|    +--- io.fabric.sdk.android:fabric:1.3.16
|    \--- com.crashlytics.sdk.android:answers-shim:0.0.4
+--- com.twitter.sdk.android:twitter:2.3.2
|    +--- com.twitter.sdk.android:tweet-composer:2.3.1
|    |    +--- com.twitter:twitter-text:1.13.0
|    |    +--- io.fabric.sdk.android:fabric:1.3.14 -> 1.3.16
|    |    +--- com.twitter.sdk.android:twitter-core:2.3.0 -> 2.3.1 (*)
|    |    \--- com.squareup.picasso:picasso:2.5.2
|    +--- com.twitter.sdk.android:twitter-core:2.3.1 (*)
|    \--- com.twitter.sdk.android:tweet-ui:2.3.2
|         +--- com.android.support:support-v4:23.1.1 -> 25.3.1 (*)
|         +--- com.twitter.sdk.android:twitter-core:2.3.1 (*)
|         \--- com.squareup.picasso:picasso:2.5.2
+--- com.crashlytics.sdk.android:crashlytics:2.6.7
|    +--- com.crashlytics.sdk.android:beta:1.2.4
|    |    \--- io.fabric.sdk.android:fabric:1.3.16
|    +--- io.fabric.sdk.android:fabric:1.3.16
|    +--- com.crashlytics.sdk.android:answers:1.3.12
|    |    \--- io.fabric.sdk.android:fabric:1.3.16
|    \--- com.crashlytics.sdk.android:crashlytics-core:2.3.16
|         +--- io.fabric.sdk.android:fabric:1.3.16
|         \--- com.crashlytics.sdk.android:answers:1.3.12 (*)
+--- com.twitter.sdk.android:tweet-composer:2.3.1 (*)
\--- com.google.firebase:firebase-core:9.0.0
     \--- com.google.firebase:firebase-analytics:9.0.0
          +--- com.google.android.gms:play-services-basement:9.0.0 -> 10.2.1 (*)
          +--- com.google.firebase:firebase-common:9.0.0 -> 10.2.1 (*)
          \--- com.google.firebase:firebase-analytics-impl:9.0.0
               +--- com.google.android.gms:play-services-base:9.0.0 -> 9.6.1 (*)
               +--- com.google.android.gms:play-services-basement:9.0.0 -> 10.2.1 (*)
               +--- com.google.firebase:firebase-iid:9.0.0 -> 10.2.1 (*)
               \--- com.google.firebase:firebase-common:9.0.0 -> 10.2.1 (*)

共有1个答案

长孙永思
2023-03-14

问题是您有几个依赖项,它们使用不同版本的支持库,这些都不同于您为项目显式声明的版本。您需要将所有这些都标准化为一个版本。理想情况下,您希望使用支持库的最新版本。

第一步是确保使用的是所有依赖项的最新版本。如果幸运的话,这可能会立即解决问题。

如果您仍然得到类似的错误,那么您需要重写支持库版本。您可以通过两种方式做到这一点:

compile 'com.jakewharton:butterknife:8.5.1', {
   exclude group: 'com.android.support'
}
 类似资料:
  • 我在使用fs.readfile进行同步时遇到了一个问题,他们没有在第一次初始化,如果我再次尝试请求,那么我就有结果了。我知道我可以用promise和我从Kriskowal找到一些有用的东西。我试过但没有成功。我不太明白如何实施它。如果有人能帮忙,我将永远感激。 代码:

  • 事件处理程序添加到GameGui.java类的GridPane中,从第82行开始。 基本上,我试图找到您在网格窗格中拖动这个对象的任何节点的索引。通过将SetonMouseEnter应用到gridpane中的每个节点,我可以在不拖动的情况下完成这一任务,但是当我试图利用SetonMouseDragEnter时,我什么也没有得到。 有人有办法让这个工作吗? 这些是我应用于GridPane中节点的事件

  • 在这种情况下是否可以避免ArrayIndexOutOfBoundsException??

  • 问题内容: 我是T-SQL命令的新手,所以我在SQL逻辑中找到了一个可以使用它并想要对其进行测试的地方,但无法弄清楚我应该如何使用它: 请提出正确的用法。谢谢! 问题答案: 您在帮助中了吗?这是一个简单的例子:

  • 我需要为密码字段设置一个错误,条件是“只允许2到22个字符和符号,\-” 但是我有点困在这里了。 这是我到目前为止得到的: 但问题是,如果我输入了_或-以外的符号,错误消息仍然不会显示。对于输入长度,错误消息显示为它应该显示的样子。

  • 你好,我正在学习OOP,通过编写一个虚拟的库管理项目在Java。 在serachBook()中,如果在ArrayList中找到book,则返回book对象,如果未找到,则抛出自定义异常BookNotFound。 问题1:它应该只返回null并在调用代码时检查返回值是否为null,还是抛出自定义异常BookNotFound。 目前我认为BookNotFinder是合适的,并且目前正在这样做。然而,我