android – java.util.zip.ZipException:重复条目

前端之家收集整理的这篇文章主要介绍了android – java.util.zip.ZipException:重复条目前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一整天都在 Android Studio中与这个错误作斗争.项目是从eclipse解决方案导入的.我一直在尝试实现针对类似帖子列出的所有修复,没有任何工作.我是Android初学者.

我很乐意提供进一步的信息.

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

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

请帮忙!!我应该尝试让它在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管理器中的最新版本toolds和sdk.我已将这些jar转换为Gradle依赖项.

的build.gradle:

// 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
    }
}

应用程序/的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
}
原文链接:https://www.f2er.com/android/308919.html

猜你在找的Android相关文章