Phonegap-plugin-barcodescanner error

When I add phonegap-plugin-barcodescanner I get following error for android:

Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class barcodescanner.xservices.nl.barcodescanner.BuildConfig found in modules jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:) and jetified-barcodescanner-release-2.1.5-runtime.jar (barcodescanner-release-2.1.5.aar)
  Duplicate class com.google.zxing.BarcodeFormat found in modules jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:) and jetified-barcodescanner-release-2.1.5-runtime.jar (barcodescanner-release-2.1.5.aar)

But this plugin worked fine with Phonegap Build

A lot has changed since PhoneGap was last updated: iOS, Android, Safari, Chrome, web security standards…

You’re using version 7.1.0 of phonegap-plugin-barcodescanner. Have you tried the current version? (8.0.1).

Yes, I tried the latest version too. Yes, I undestand it, but I just want to say that this plugin works fine with phonegap build with no errors. I also try cordova-plugin-barcodescanner for replacement, it successfully builds with this plugin, but cordova plugin have some problems, for example it rotates camera when scanning

I also try fttx-phonegap-plugin-barcodescanner, but tihs plugin gives errot with AndroidX:

Task :app:compileDebugJavaWithJavac FAILED
/Mobile/platforms/android/app/src/main/java/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:27: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
^
/Mobile/platforms/android/app/src/main/java/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:77: error: cannot find symbol
private LocalBroadcastManager broadcastManager;

The most popular barcode plugin seems to be phonegap-plugin-barcodescanner, even though it has been deprecated by its author. Last week, it had 13,192 downloads, which is fairly heavy for a plugin.

I also use it for projects I’ve done for customers. What problems do you have with it?

I write it in my topic qestion, I got error when I build:

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class barcodescanner.xservices.nl.barcodescanner.BuildConfig found in modules jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:) and jetified-barcodescanner-release-2.1.5-runtime.jar (barcodescanner-release-2.1.5.aar)
  Duplicate class com.google.zxing.BarcodeFormat found in modules jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:) and jetified-barcodescanner-release-2.1.5-runtime.jar (barcodescanner-release-2.1.5.aar)
  Duplicate class com.google.zxing.Binarizer found in modules jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:) and jetified-barcodescanner-release-2.1.5-runtime.jar (barcodescanner-release-2.1.5.aar)
  Duplicate class com.google.zxing.BinaryBitmap found in modules jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:) and jetified-barcodescanner-release-2.1.5-runtime.jar (barcodescanner-release-2.1.5.aar)
  Duplicate class com.google.zxing.ChecksumException found in modules jetified-barcodescanner-release-2.1.5-runtime.jar (:barcodescanner-release-2.1.5:) and jetified-barcodescanner-release-2.1.5-runtime.jar (barcodescanner-release-2.1.5.aar
......

Go to the documentation to learn how to Fix dependency resolution errors.

This means another plugin is trying to use some of the same modules and causing conflict.

To find out which one, take other plugins out of your project and try building again, until you determine which one is causing the problem.

Yes, you are right, the problem is with some of my plugins and I fix it, thanks :slight_smile:

Anything more you can add, to help the next person with the same issue?

No, the problem was with my plugin cordova-plugin-evoca-biometric-authentication .gradle file, and I fix it

I am using cordova-plugin-firebase-analytics and cordova-plugin-admob-free getting error as

Duplicate class com.google.android.gms.common.api.zza found in modules

What change should I do?

This appears to be a separate issue. Could you open a new issue for it?