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

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

问题描述

我已经整天在机器人工作室争夺这个错误。项目从一个Eclipse解决方案导入。我一直在努力实现列出类似的帖子,没有什么工作的所有修补程序。我是一个Android的初学者。

我会很乐意提供任何进一步的信息。

错误:未能执行任务:应用程序:packageAllDebugClassesForMultiDex

  

java.util.zip.ZipException:重复的条目:COM /谷歌/ zxing /酒吧codeFormat.class

请帮助!如果我只是设法得到它在Eclipse中运行?

  //顶级构建文件,你可以到各子项目/模块添加常用的配置选项。
buildscript {
    库{
        jcenter()
    }
    依赖{
        类路径com.android.tools.build:gradle:1.1.2
    }
}

allprojects {
    库{
        jcenter()
    }
}

应用插件:com.android.application

安卓{
    compileSdkVersion 21
    buildToolsVersion21.1.2

    defaultConfig {
        的applicationIDcom.appname.android
        的minSdkVersion 8
        targetSdkVersion 18
        multiDexEnabled真
    }

    buildTypes {
        推出 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'ProGuard的-rules.txt
        }
    }
}

依赖{
    编译com.android.support:support-v4:22.1.1
    编译文件(库/ ksoap2-机器人组装-3.1.0-JAR-与-dependencies.jar)
    提供的文件(库/ zxing-core.jar添加)
}
 

解决方案

请确保您有最新版本toolds和SDK的SDK管理器。我已经转换的摇篮相关性。

build.gradle

  //顶级构建文件,你可以到各子项目/模块添加常用的配置选项。
buildscript {
    库{
        jcenter()
        行家{URLHTTP://ksoap2-android.google$c$c.com/svn/m2-repo'} //<  - 对于KSOAP添加
    }

    依赖{
        类路径com.android.tools.build:gradle:1.1.3'//<  - 更新
    }
}

allprojects {
    库{
        jcenter()
        行家{URLHTTP://ksoap2-android.google$c$c.com/svn/m2-repo'} //<  - 对于KSOAP添加
    }
}
 

应用程序/ build.gradle

 应用插件:com.android.application

安卓{
    compileSdkVersion 22
    buildToolsVersion22.0.1//<  - 更新

    defaultConfig {
        的applicationIDcom.appname.android
        的minSdkVersion 8
        targetSdkVersion 22 //<  - 更新
        // multiDexEnabled真//<  - 你不需要这个
    }

    buildTypes {
        推出 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'ProGuard的-rules.txt
        }
    }
}

依赖{
    编译com.android.support:support-v4:22.1.1
    编译com.google code.ksoap2-机器人:ksoap2-安卓3.4.0
    //编译文件(库/ ksoap2-机器人组装-3.1.0-JAR-与-dependencies.jar)//<  - 避免使用广口瓶
    copmilecom.google.zxing:核心:3.2.0
    //提供的文件(库/ zxing-core.jar添加)//<  - 避免使用广口瓶
}
 

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.

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

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

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')
}

解决方案

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

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' } // <-- added for ksoap
    }

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

allprojects {
    repositories {
        jcenter()
        maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' } // <-- 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
    copmile 'com.google.zxing:core:3.2.0'
    // provided files('libs/zxing-core.jar') // <-- avoid using jars
}

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

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