【问题标题】:Build causing java.util.zip.ZipException: duplicate entry error构建导致 java.util.zip.ZipException: 重复输入错误
【发布时间】:2017-08-19 14:39:00
【问题描述】:

很多人似乎在 Stackoverflow 上遇到过这个问题,但没有人和我遇到过同样的问题和解决方案。

“错误:任务 ':app:transformClassesWithJarMergingForDebug' 执行失败。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:org/apache/commons/collections/ArrayStack.class"

这是我的 build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.hey"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        multiDexEnabled true
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'commons-validator:commons-validator:1.4.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:design:25.3.1'
    compile 'com.aurelhubert:ahbottomnavigation:2.0.6'
    testCompile 'junit:junit:4.12'
    //compile 'com.roughike:bottom-bar:2.3.1'
    //compile 'com.android.support:design:26.0.0-alpha1'
}

我遇到了这个错误:

错误:任务 ':app:transformClassesWithDexForDebug' 执行失败。 com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: 多个dex文件定义Lorg/apache/commons/集合/缓冲区;

我使用multiDexEnabled true 修复了它,但随后出现了重复输入错误。

编辑:

问题出在commons-validator:commons-validator:1.4.1,但我仍然很好奇为什么以及如何修复此错误以仍然能够使用验证器。

【问题讨论】:

    标签: java android android-studio


    【解决方案1】:

    如果你有兴趣,我通过替换解决了这个问题:

    compile 'commons-validator:commons-validator:1.4.1'

    与:

    compile 'commons-validator:commons-validator:1.6'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-09
      • 1970-01-01
      • 2019-09-06
      • 1970-01-01
      • 2015-10-20
      • 2011-09-14
      • 1970-01-01
      相关资源
      最近更新 更多