Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program type already present: com.google.zxing.ChecksumException

I try using zxing library to scan a qrcode, there's no error until I run the app like this:

Program type already present: com.google.zxing.ChecksumException

Message{kind=ERROR, text=Program type already present: com.google.zxing.ChecksumException, sources=[Unknown source file], tool name=Optional.of(D8)}

enter image description here

here's my gradle:

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.std.scanner"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
}

i think i should using "exclude" in my gradle dependecies, but I don't know how to write the code. please help, thanks in advance.

like image 904
maghfirzakir Avatar asked Apr 29 '18 10:04

maghfirzakir


3 Answers

solve by add in build.gradle (app)

configurations {
    implementation.exclude group: 'com.google.zxing'
}
like image 69
Yudi karma Avatar answered Nov 09 '22 05:11

Yudi karma


I was getting the same error except it was the com.google.zxing.BarcodeFormat. Turned out i had the BarcodeFormat in the app from a .jar library i had in /libs.

Have you tried searching for ChecksumException class in you app by pressing Ctrl + N and typing "ChecksumException" ?

like image 34
GudniPall Avatar answered Nov 09 '22 03:11

GudniPall


My mistake was i added a plugin (qrcode) in pubspec.yml which overwrite another class defined from another plugin (animated_qr_code_scanner), and then exist a conflict between plugins (and classes). You can try comenting the last added plugin to locate the used classes.

like image 21
Pedro Molina Avatar answered Nov 09 '22 04:11

Pedro Molina