直到一周前它都运行良好,但这周构建不起作用,我得到了下面的错误。我尝试了下面的方法,但我还没有解决它。任何小问题都是好的,所以如果有人知道任何提示或解决方案,请告诉我。
我尝试过的
- 降级类路径(“com.google.gms:谷歌服务:4.3.3英寸)
- 指定com.google.android.gms的版本:播放-服务-测量-API和com.google.android.gms:游戏服务测量
- Gradle版本升级、降级
■发展环境
React:16.9.0
天然React:0.61.5
Android等级:4.0.0
Firebase(谷歌服务):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>.
3条答案
按热度按时间kdfy810k1#
我遇到了同样的问题...如果您使用的是firebase依赖项和物料清单(bom),可能是您没有更新它,因为Android Studio不会提示您更新。目前最新的bom是26.1.1(但请检查documentation),因此它应该如下所示:
implementation platform('com.google.firebase:firebase-bom:26.1.1')
.pcww981p2#
当存在依赖项冲突时,会出现此错误。例如:您有两个依赖项A和B,并且A中已经提供了B所需的依赖项。此时发生冲突。更多信息请参见[Fix Dependency resolution error][1] [1]:https://developer.android.com/studio/build/dependencies#resolution_errors
在我的情况下,我使用了Interrestial广告和谷歌admob都depepencies。这是导致错误。
解决方案:按两次Shift键您应该会看到弹出窗口在菜单中,选择右侧的所有选项,选择“包括非项目”然后搜索导致错误的类。您应该会在logcat中看到该类名。然后从build.gradle(应用程序级别)中删除相应的依赖项
mlmc2os53#
添加此依赖项