-2

im trying to use zxing to scan barcode using android studio but when i try to add zxing gradle i got this error

Error:Execution failed for task ':app:transformClassesWithJarMergingForAristiDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class

this is what all gradle i have

compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.jakewharton:butterknife-compiler:8.4.0'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    compile 'com.google.android.gms:play-services-location:10.2.1'
    compile 'com.karumi:dexter:2.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'me.dm7.barcodescanner:zxing:1.9'    
    testCompile 'junit:junit:4.12'

can somebody tell me what should i do ?? Or what should i search to remove this error ?

  • 5 sec searching, it was really that hard google the error before post the question? http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult – paul May 16 '17 at 07:47
  • my problem is the build was not by me, and im suppose to change it to be better but i dont know which have repeat library... how should i do to find which library who have same file ?? – ChronoAngeL May 16 '17 at 08:12

1 Answers1

1

Sorry because i was newbie in java i dont know how to solve simple problem like this. After searching for a week im already found how to solve. The problem is my jar contain same class in same directory this why i got this error. In my case, it was solved after i exclude which directory who cause this

compile ('me.dm7.barcodescanner:zxing:1.9.3'){
        exclude group: 'com.google.zxing'
    }