【问题标题】:Android Studio buildbox error java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.classAndroid Studio buildbox 错误 java.util.zip.ZipException:重复条目:android/support/v4/print/PrintHelper$PrintHelperStubImpl.class
【发布时间】:2017-08-11 11:06:20
【问题描述】:

嘿,当我尝试在 android 上构建我的 apk 时,我收到了这个错误,我不明白这是什么意思,你能帮我吗? :

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.class

这是我的 build.gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.frgg.apps.thetri"
    minSdkVersion 14
    targetSdkVersion 23
    multiDexEnabled true
 dexOptions {
        javaMaxHeapSize "4g"
    }

    ndk {
        moduleName "player_shared"
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
sourceSets.main {
    jni.srcDirs = []// <-- disable automatic ndk-build call
}
productFlavors {
}
}
dependencies {
compile('com.google.android.gms:play-services:+') { exclude module: 'support-v4' }
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')

}

在 gradle 同步期间不会出现错误。但是当我尝试构建 apk 时出现

可能是什么问题?

编辑

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

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: 执行时出错带有参数的主类 com.android.dx.command.Main 的 java 进程 {--dex --num-threads=4 --multi-dex --main-dex-list C:\Users\hotrod\Desktop\APPS\ android5\app\build\intermediates\multi-dex\debug\maindexlist.txt --输出 C:\Users\hotrod\Desktop\APPS\android5\app\build\intermediates\transforms\dex\debug\folders\1000\1f \main C:\Users\hotrod\Desktop\APPS\android5\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}

【问题讨论】:

    标签: android android-studio duplicates android-support-library android-multidex


    【解决方案1】:

    删除

    compile('com.google.android.gms:play-services:+') { exclude module: 'support-v4' }
    compile files('libs/support-v4-19.0.1.jar') //Remove from Local Drive
    

    使用

    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.google.android.gms:play-services:11.0.4'
    

    仅供参考

    也从本地 libs 文件夹中删除上述库

    最后,清理重建并运行

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-18
    • 1970-01-01
    • 2015-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-09
    • 1970-01-01
    相关资源
    最近更新 更多