Search code examples
androidzxingbarcode-scanner

Android: Program type already present: com.google.zxing.BarcodeFormat


I've develop a project using zxing to scan the barcode. I had followed the tutorial from here, but unfortunately I got error when I tried to run the project to device. The error that I get is

enter image description here

This is the build.gradle(app)

dependencies {
     implementation fileTree(include: ['*.jar'], dir: 'libs')
     implementation 'com.android.support:appcompat-v7:27.1.1'
     implementation 'com.android.support:design:27.1.1'
     implementation 'com.android.support.constraint:constraint-layout:1.1.0'
     testImplementation 'junit:junit:4.12'
     androidTestImplementation 'com.android.support.test:runner:1.0.2'
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

     // volley
     compile 'com.android.volley:volley:1.0.0'

     // butter knife
     compile 'com.jakewharton:butterknife:8.8.1'
     annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

     // picasso
     implementation 'com.squareup.picasso:picasso:2.71828'

     // QR Zxing Library
     implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
}

Below is External Libraries list.

enter image description here


Solution

  • After a day I tried to find out the solution, but everything failed. Then I decided to create a new project and copy the current source code together with build.gradle(app). Luckily no more error occurred when I run new project.

    But I still don't know what the actual reason why I got that error before this, so I assume maybe some part of the old project are missing or have some bug on it.