Duplicate dependencies in flutter app using qrscan and flutter_facebook_auth

1.1k Views Asked by At

Yeap, i know it sound rare, but when gradle runs, gives a Duplicate Dependencies in task ':app:checkDebugDuplicateClasses' with 'com.google.zxing.*'. Apparently one flutter package use com.github.leyan95:android-zxingLibrary:0.1.2-PRE and the other one com.google.zxing:core:3.3.3 and both has the class com.google.zxing.BarcodeFormat among other ones.

Here is the output:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.zxing.BarcodeFormat found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.Binarizer found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.BinaryBitmap found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.ChecksumException found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.DecodeHintType found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.Dimension found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.EncodeHintType found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.FormatException found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.InvertedLuminanceSource found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.LuminanceSource found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.MultiFormatReader found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.MultiFormatWriter found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.MultiFormatWriter$1 found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.NotFoundException found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.PlanarYUVLuminanceSource found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.RGBLuminanceSource found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.Reader found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.ReaderException found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.Result found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.ResultMetadataType found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.ResultPoint found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.ResultPointCallback found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.Writer found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.WriterException found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.AztecDetectorResult found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.AztecReader found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.AztecWriter found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.decoder.Decoder found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.decoder.Decoder$1 found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.decoder.Decoder$Table found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.detector.Detector found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.detector.Detector$Point found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.encoder.AztecCode found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.encoder.BinaryShiftToken found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.encoder.Encoder found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.encoder.HighLevelEncoder found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
  Duplicate class com.google.zxing.aztec.encoder.HighLevelEncoder$1 found in modules jetified-android-zxingLibrary-0.1.2-PRE-runtime.jar (com.github.leyan95:android-zxingLibrary:0.1.2-PRE) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)...
  (and so on with every class of the dependency com.google.zxing)
  

  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
Exception: Gradle task assembleDebug failed with exit code 1

Any ideas on where to start for look a solution?

1

There are 1 best solutions below

0
On

I found the solution, the only thing i need to do is add the next line to the gradle

configurations.all {
    exclude group: 'com.google.zxing', module: 'core'
}

Hope the solution could help others.