java.util.zip.ZipException:重复条目 [英] java.util.zip.ZipException: duplicate entry

查看:45
本文介绍了java.util.zip.ZipException:重复条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我整天都在 Android Studio 中与这个错误作斗争.项目是从 Eclipse 解决方案导入的.我一直在尝试实施为类似帖子列出的所有修复程序,但没有任何效果.我是 Android 初学者.

I have been battling this error all day in Android Studio. Project was imported from an eclipse solution. I have been trying to implement all fixes that are listed for similar posts, nothing is working. I am an Android beginner.

我很乐意提供更多信息.

I will be happy to provide any further information.

错误:任务:app:packageAllDebugClassesForMultiDex"的执行失败.

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.

java.util.zip.ZipException:重复条目:com/google/zxing/BarcodeFormat.class

java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class

请帮忙!!我应该尝试让它在 Eclipse 中运行吗?

Please help!! Should I just try to get it to run in Eclipse?

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.2'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.appname.android"
        minSdkVersion 8
        targetSdkVersion 18
        multiDexEnabled true
    }

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

dependencies {
    compile 'com.android.support:support-v4:22.1.1'
    compile files('libs/ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar')
    provided files('libs/zxing-core.jar')
}

推荐答案

确保您拥有来自 SDK 管理器的最新构建工具和 sdk.我已将那些 jars 转换为 Gradle 依赖项.

Make sure you have the latest build toolds and sdk from the SDK manager. I have converted those jars to Gradle dependencies.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' } // <-- added for ksoap
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.3' // <-- updated
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' } // <-- added for ksoap
    }
}

app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1" // <-- updated

    defaultConfig {
        applicationId "com.appname.android"
        minSdkVersion 8
        targetSdkVersion 22  // <-- updated
        // multiDexEnabled true  // <-- you do not need this
    }

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

dependencies {
    compile 'com.android.support:support-v4:22.1.1'
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.4.0'
    // compile files('libs/ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar') // <-- avoid using jars
    compile 'com.google.zxing:core:3.2.0'
    // provided files('libs/zxing-core.jar') // <-- avoid using jars
}

这篇关于java.util.zip.ZipException:重复条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆