0

I have been tried all solutions, which are all related my question in the stack overflow and google too. i fed up with this error as long.

Am using lib for scanning qr code which is added in the below gradle file, so upon i add this lib only am getting the following error

this is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.inspirenetz.app.inpartner"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    testCompile 'org.json:json:20140107'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    compile 'com.android.support:support-v4:23.1.0'
    compile 'com.github.satyan:sugar:1.4'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.fasterxml.jackson.core:jackson-core:2.4.1'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.1'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1'
    compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'

    compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
    compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'
    compile 'com.google.zxing:core:3.2.1'

    // Avoid the 64K limit, Multidex support for Android 5.0 and higher
    compile 'com.android.support:multidex:1.0.1'

    compile files('libs/mswiperAPIVer2.0.jar')

    repositories { mavenCentral()
        maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/" }
    }

}

Here hell of the error killing me

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

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/aztec/AztecDetectorResult.class

Would really appreciated some expected solution will solve many related questions too

Thanks in advance.!

Raju
  • 1,183
  • 3
  • 11
  • 19
  • 1
    This is in no way an answer to your problem but.. If the problem lies in `zxing`, then you can always switch to e.g. the `google.vision.barcode` instead. It's the Google default barcode library shipped in the support lib. Probably [this post](https://www.varvet.com/blog/android-qr-code-reader-made-easy/) will get you up and running with a QR reader in no time! – Algar Nov 25 '16 at 09:26
  • oh my goodness at last i got reply on this question thanks.!, but may i know are you using this code and about its performance – Raju Nov 25 '16 at 09:34
  • actually the above lib also working well for me one project but upon i try to add another project its throws this error – Raju Nov 25 '16 at 09:36
  • Was that a question in your first reply...? And yeah, or course `zxing` should work, I'm not sure what your error is due to. – Algar Nov 25 '16 at 10:10
  • your post also not help same error from long days i can't solve this – Raju Dec 02 '16 at 15:07

2 Answers2

0

At last i found the solution of my question from this post after long days back. and i have changed the lib for QR/Bar code scanner as well.

Problem: I using the jar externally name as core.jar. so, the AztecDetectorResult.class already contain in core.jar and in my scanner lib dependency core-3.2.1 too. so its throws the duplicate entry error as below.

com.android.build.api.transform.TransformException: 
java.util.zip.ZipException: duplicate entry: com/google/zxing/aztec/AztecDetectorResult.class

Solution: I tried to exclude it from the core.jar as below.

configurations{
    all*.exclude module: 'core'
}

And i have changed my new lib too ZXing Android Embedded for efficient QR/Bar code scanner.

Now its working like charm.!

Community
  • 1
  • 1
Raju
  • 1,183
  • 3
  • 11
  • 19
0

Problem:

I find out I am not only contain core.jar ,but also compile zxing related remote repository, so it result in the error above.

Solution:

The solution is deleting the core.jar file then it's ok.

peter chen
  • 21
  • 2
  • I'm not quite sure **what** this is; it appears to be both an unrelated question and the solution to the unrelated question. You should write this as a new question (possibly linking to this question as reference), and then answer with your solution. You can find more information about self-answering questions [**here**](https://stackoverflow.com/help/self-answer). – Obsidian Age Sep 05 '17 at 03:35