1
votes

I am not sure why I am getting this error. Any kind of help will be highly appreciable

Error:Execution failed for task ':packageAllDebugClassesForMultiDex'.

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

heres my app/gradle file

apply plugin: 'android'

dependencies { compile fileTree(include: '*.jar', dir: 'libs') compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.google.android:annotations:4.1.1.4' }

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' } } allprojects { repositories { jcenter() maven { url "http://releases.payworks.io/artifactory/mpos" } } } android { compileSdkVersion 23 buildToolsVersion '23.0.2' useLibrary 'org.apache.http.legacy'

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

defaultConfig 
{        
    multiDexEnabled true
}
dexOptions {
    javaMaxHeapSize "2g"
}
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    instrumentTest.setRoot('tests')        
    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    compile 'io.card:card.io:5.0.1@aar'
    compile project(':star')
    compile project(':zxing-android-embedded')
    compile 'io.payworks:mpos.android.ui:2.7.0:@aar'
    compile 'io.payworks:mpos.android.core:2.7.0:@aar'
    compile 'io.payworks:mpos.android.accessories.miura:2.7.0:@aar'
    compile 'io.payworks:mpos.android.comlinks.bluetooth:2.7.0:@aar'
    compile 'io.payworks:mpos.android.accessories.verifone-e105:2.7.0:@aar'
    compile 'io.payworks:mpos.android.comlinks.verifone-e105:2.7.0:@aar'
    compile 'io.payworks:mpos.android.accessories.sewoo:2.7.0:@aar'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.squareup:otto:1.3.5'
    compile 'com.squareup.okhttp:okhttp:2.7.2'
    compile 'com.parse.bolts:bolts-android:1.2.1'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.4.4'
    compile 'com.verifone:verifone-pwmadk:3.0.2@aar'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.google.android.gms:play-services-identity:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
dexOptions {
    preDexLibraries = false
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
}
1

1 Answers

2
votes

I am not sure if it will work, but you could try using a DuplicationStrategy (https://docs.gradle.org/current/javadoc/org/gradle/api/file/DuplicatesStrategy.html) like so:

packageAllDebugClassesForMultiDex {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}