java.util.zip.ZipException:重复条目支持v4 PrintHelper $ 1.class

时间:2015-06-16 03:28:50

标签: 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期间不会显示错误。就在我尝试运行应用程序时 可能是什么问题?

1 个答案:

答案 0 :(得分:3)

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

我的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