Android构建不起作用(在模块中发现重复的类com.google.android.gms.internal.measurement.zzbt)

直到一周前它都运行良好,但本周构建不起作用,我收到以下错误。我尝试了以下,但我还没有解决它。任何小事都可以,所以如果有人知道任何提示或解决方案,请告诉我。

?我试过的

  • 降级类路径(“com.google.gms:google-services:4.3.3”)
  • 指定 com.google.android.gms 的版本:play-services-measurement-sdk-api 和 com.google.android.gms:play-services-measurement
  • Gradle 版本升级、降级

?开发环境
react?16.9.0
react-native?0.61.5
Android Gradle?4.0.0
Firebase(google-services)?4.3.4


> Task :app:checkDebugDuplicateClasses FAILED

> Transform artifact play-services-measurement.aar (com.google.android.gms:play-services-measurement:17.4.4) with DexingWithClasspathTransform

> Transform artifact play-services-measurement-impl.aar (com.google.android.gms:play-services-measurement-impl:17.4.4) with DexingWithClasspathTransform
ReactNativeFirebase WARNING: NPM package '@react-native-firebase/auth' depends on '@react-native-firebase/app' v8.3.1 but found v8.4.0, this might cause build issues or runtime crashes.
501 actionable tasks: 7 executed, 494 up-to-date
D8: Type com.google.android.gms.internal.measurement.zzig is referenced as an interface from `com.google.android.gms.internal.measurement.zzby`.
D8: Interface `com.google.android.gms.measurement.internal.zzhd(classpath class)` used as super class of `com.google.android.gms.measurement.AppMeasurement$UserProperty`.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.measurement.zzbt found in modules jetified-play-services-measurement-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement:17.4.4) and jetified-play-services-measurement-sdk-api-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-sdk-api:17.5.0)
  Duplicate class com.google.android.gms.internal.measurement.zzbu found in modules jetified-play-services-measurement-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement:17.4.4) and jetified-play-services-measurement-sdk-api-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-sdk-api:17.5.0)
  Duplicate class com.google.android.gms.internal.measurement.zzfw found in modules jetified-play-services-measurement-base-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.5.0) and jetified-play-services-measurement-impl-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.4)
  Duplicate class com.google.android.gms.internal.measurement.zzfy found in modules jetified-play-services-measurement-base-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.5.0) and jetified-play-services-measurement-impl-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.4)
  Duplicate class com.google.android.gms.internal.measurement.zzfz found in modules jetified-play-services-measurement-base-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.5.0) and jetified-play-services-measurement-impl-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.4)
  Duplicate class com.google.android.gms.internal.measurement.zzga found in modules jetified-play-services-measurement-base-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.5.0) and jetified-play-services-measurement-impl-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.4)
  Duplicate class com.google.android.gms.internal.measurement.zzgb found in modules jetified-play-services-measurement-base-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.5.0) and jetified-play-services-measurement-impl-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.4)
  Duplicate class com.google.android.gms.measurement.internal.zzgz found in modules jetified-play-services-measurement-base-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.5.0) and jetified-play-services-measurement-impl-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.4)
  Duplicate class com.google.android.gms.measurement.internal.zzik found in modules jetified-play-services-measurement-base-17.5.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.5.0) and jetified-play-services-measurement-impl-17.4.4-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.4)

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

回答

我遇到了同样的问题...如果您使用的是 firebase 依赖项并且您使用的是物料清单 (bom),则可能是您没有更新它,因为 Android Studio 不会提示您这样做。现在最新的BOM是26.1.1(但检查文档),所以它应该是这样的:implementation platform('com.google.firebase:firebase-bom:26.1.1')


以上是Android构建不起作用(在模块中发现重复的类com.google.android.gms.internal.measurement.zzbt)的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>