java.util.zip.ZipException : duplicate entry support v4 PrintHelper$1. 类

标签 java android

我不确定这个错误是什么意思。

Error:Execution failed for task': eCampus :  packageAllDefaultFlavorDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$1.class

我的 bulid.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion '22.0.1'
    defaultConfig {
        applicationId "tw.edu.chu.ecampus"
        minSdkVersion 11
        targetSdkVersion 21
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    dexOptions {
        preDexLibraries = false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}
repositories {
    mavenCentral()
}
dependencies {
    compile project(':G0.10.ABS')//ActionBarSherlock
    compile project(':vitamio')
    compile 'com.google.android.gms:play-services-maps:7.5.0'
    compile 'com.google.android.gms:play-services-gcm:7.5.0'
    compile 'com.android.support:multidex:1.0.1'
    androidTestCompile 'com.android.support:multidex-instrumentation:1.0.1'
}

在 gradle sync 期间不会出现错误。就在我尝试运行应用程序时 可能是什么问题?

最佳答案

我遇到了同样的错误,我解决了,但我只是把我的情况告诉你;

我的 bulid.gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile ('com.android.support:appcompat-v7:22.0.0') 
    compile files('libs/android-async-http-1.4.8.jar')
    compile files('libs/android-support-v4.jar')
    compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}

错误是 com.android.support:appcompat-v7:22.0.0 包含 support-v4.jar,所以我将其删除;

解决build.gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile ('com.android.support:appcompat-v7:22.0.0') {
        exclude module: 'support-v4'
    }
    compile files('libs/android-async-http-1.4.8.jar')
    compile files('libs/android-support-v4.jar')
    compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}

所以也许你应该检查你的依赖关系,也许你的编译文件有两个文件包括 support-v4

关于java.util.zip.ZipException : duplicate entry support v4 PrintHelper$1. 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30858292/

相关文章:

java - JPA/Hibernate 无法创建名为 Order 的实体

java - 为什么 Java TreeMap 不打印所有插入的条目

android - 如何在android中获取手机的smsc号码?

java - 语言环境:语言名称到国家/语言代码

javascript - react native :Disable Android Drawer

java - 当我的内容离开屏幕时如何查看我的整个布局?

java - 如何计算我的应用程序中特定事件的耗时?

java - 如何在其他类中传递类的值?

java - 导致主进程等待另一个进程完成

android - 多个顺序 Observable,每个 Observable 之间有时间延迟