2

我开始在我的项目中使用 MLKit 条形码扫描仪,并Duplicate class在尝试运行应用程序时收到错误消息。另外,我尝试了exclude firebase-commonand exclude firebase-components,但没有帮助,因为它破坏了推送通知或 MLKit 扫描器。

从 Firebase 和 Google 我们使用这些依赖项:

playServices: [
   base     : "com.google.android.gms:play-services-base:17.0.0",
   maps     : "com.google.android.gms:play-services-maps:17.0.0",
   location : "com.google.android.gms:play-services-location:17.0.0",
   safetynet: "com.google.android.gms:play-services-safetynet:17.0.0",
],
firebase: [
   messaging: "com.google.firebase:firebase-messaging:20.0.0",
   barcode: "com.google.mlkit:barcode-scanning:16.0.0"
]
Duplicate class com.google.firebase.components.AbstractComponentContainer found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.Component found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.Component$$Lambda$1 found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.Component$$Lambda$2 found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.Component$$Lambda$3 found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.Component$1 found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.Component$Builder found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.ComponentContainer found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.ComponentDiscovery found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.ComponentDiscovery$1 found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.ComponentDiscovery$MetadataRegistrarNameRetriever found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)
Duplicate class com.google.firebase.components.ComponentDiscovery$RegistrarNameRetriever found in modules jetified-firebase-common-19.0.0-runtime.jar (com.google.firebase:firebase-common:19.0.0) and jetified-firebase-components-16.0.0-runtime.jar (com.google.firebase:firebase-components:16.0.0)

and more classes ...
4

1 回答 1

2

请尝试将其更新到最新版本的 Firebase。第一季度底层基础设施发生了一些变化。

于 2020-06-25T18:03:54.933 回答