Sergio Magoo Quintero
Sergio Magoo Quintero

Reputation: 249

How to solve a Duplicate zip entry

I have this problem: When I run my project on Android Studio it works fine, but when I try to Build the APK (on BUILD > BUILD Apk(s)) it shows me the next error:

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. java.io.IOException: Can't write [/Users/sergio/Documents/ink/touch_android/app/build/intermediates/multi-dex/debug/componentClasses.jar] (Can't read [/Users/sergio/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.3.3/63b77400b5f1cf83a81823562c48d3120ef5518e/jackson-databind-2.3.3.jar(;;;;;;**.class)] (Duplicate zip entry [jackson-databind-2.3.3.jar:com/fasterxml/jackson/databind/JsonDeserializer$None.class]))

as far as I know this is caused by a duplicated class called JsonDeserializer, that I found on my project

enter image description here

but I can't find a way to 'unlink' this files from each jar listed. This is my gradle file.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "---"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode -
        versionName "-"
        renderscriptTargetApi 22
        renderscriptSupportModeEnabled true
        multiDexEnabled true
        ndk {
            abiFilters "x86", "armeabi-v7a", "armeabi"
        }

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { resources.srcDirs = ['src/main/resources', 'src/main/java/includes'] } }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'

    }
}

dependencies
        {
            //compile fileTree(include: ['*.jar'], dir: 'libs')
            testCompile 'junit:junit:4.12'
            implementation files('libs/gson-2.5.jar')
            implementation files('libs/guava-18.0.jar')
            implementation files('libs/snmp6_1.jar')
            implementation 'com.crittercism:crittercism-android-agent:5.6.4'
            implementation files('libs/jackson-annotations-2.2.3.jar')
            implementation files('libs/jackson-databind-2.2.3.jar')
            implementation files('libs/httpmime-4.3.2.jar')
            implementation files('libs/httpcore-4.3.1.jar')
            implementation files('libs/commons-lang3-3.4.jar')
            implementation files('libs/commons-validator-1.4.0.jar')
            implementation files('libs/jackson-core-2.2.3.jar')
            implementation files('libs/commons-net-3.1.jar')
            implementation files('libs/ZSDK_ANDROID_API.jar')
            implementation files('libs/opencsv-2.2.jar')
            implementation files('libs/commons-io-2.2.jar')
            implementation files('libs/mrzjniInterfaceJar.jar')
            implementation 'com.kyleduo.switchbutton:library:1.4.1'
            implementation 'com.github.nkzawa:socket.io-client:0.3.0'
            implementation 'fr.tvbarthel.blurdialogfragment:lib:2.2.0'
            implementation 'com.android.support:multidex:1.0.1'
            implementation('de.keyboardsurfer.android.widget:crouton:1.8.5@aar')
            implementation 'com.android.support:appcompat-v7:23.4.0'
            implementation 'com.android.support.constraint:constraint-layout:1.0.2'
            implementation 'com.android.support:design:23.4.0'
            implementation files('libs/cw-deviceapi20171026.jar')
            implementation 'org.jmrtd:jmrtd:0.5.5'
            implementation 'net.sf.scuba:scuba-sc-android:0.0.9'
            implementation 'com.madgag.spongycastle:prov:1.54.0.0'
            implementation 'edu.ucar:jj2000:5.2'
            implementation 'com.github.mhshams:jnbis:1.1.0'
            implementation files('libs/BrotherPrintLibrary.jar')
            implementation files('libs/MobilePrintLib.jar')
        }

Upvotes: 1

Views: 938

Answers (2)

Abdul Kawee
Abdul Kawee

Reputation: 2727

try removing this implementation

implementation files('libs/jackson-core-2.2.3.jar')

and do

Build > Clean Project

Upvotes: 1

HaroldSer
HaroldSer

Reputation: 2065

In the module where you are adding jackson dependency exclude that class which is already in the other lib. Otherwise, exclude it from the other lib and leave it on the jackson.

Upvotes: 1

Related Questions