首页 > 解决方案 > 使用 qrscan 和 flutter_facebook_auth 在 Flutter 应用程序中重复依赖项

问题描述

是的,我知道这听起来很罕见,但是当 gradle 运行时,会在任务 ':app:checkDebugDuplicateClasses' 和 'com.google.zxing.*' 中给出重复的依赖项。显然,一个颤振包使用com.github.leyan95:android-zxingLibrary:0.1.2-PRE,另一个com.google.zxing:core:3.3.3和两者都具有com.google.zxing.BarcodeFormat其他类。

这是输出:

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

关于从哪里开始寻找解决方案的任何想法?

标签: flutterflutter-facebook-loginflutter-qrcode

解决方案


我找到了解决方案,我唯一需要做的就是将下一行添加到 gradle

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

希望解决方案可以帮助其他人。


推荐阅读