简体   繁体   English

修复 java.util.zip.ZipException

[英]fixing java.util.zip.ZipException

In my Android project after I add some libraries when I'm running it a exception arose.在我的 Android 项目中,当我运行它时添加了一些库后,出现了异常。 my build.gradle file is as below.我的 build.gradle 文件如下。

android {
    compileSdkVersion 'Google Inc.:Google APIs:21'
    buildToolsVersion '23.0.2'
    defaultConfig {
        applicationId "com.marpak.livefarmerpro"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 69
        versionName '2.0.15'
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}


dependencies {
    compile project(':holoColorPickermaster')
    compile project(':qRCodeReaderViewlib')
    compile project(':volley')
    compile project(':library')
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.android.support:multidex:'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'

}

and when I running the app ir gives me following error.当我运行应用程序时,ir 给了我以下错误。

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/concurrent/BasicFuture.class

I know this is because some duplication of files.我知道这是因为文件重复。 can someone help he to fix this issue.有人可以帮助他解决这个问题。 thanks and regards!感谢和问候!

I got this issue when I had 2 classes with the same class name.当我有两个类名相同的类时,我遇到了这个问题。 Doing ./gradlew app:assembleDebug --stacktrace --debug --info said./gradlew app:assembleDebug --stacktrace --debug --info

java.util.zip.ZipException: duplicate entry: com/arka/commonlib/model/Charge.class java.util.zip.ZipException:重复条目:com/arka/commonlib/model/Charge.class

You can test putting this on root of directory in the Terminal您可以测试将其放在终端目录的根目录中

./gradlew clean

for more detail visit this : Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'有关更多详细信息,请访问: 错误:任务 ':app:transformClassesWithJarMergingForDebug' 的执行失败

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM