Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix this error duplicate class found in module class.jar

Tags:

build.gradle

I got this error when I try to generate signed apk for my project

Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:16.5.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics found in modules classes.jar (com.google.android.gms:play-services-measurement-api:16.5.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Event found in modules classes.jar (com.google.android.gms:play-services-measurement-api:16.5.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Param found in modules classes.jar (com.google.android.gms:play-services-measurement-api:16.5.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics$UserProperty found in modules classes.jar (com.google.android.gms:play-services-measurement-api:16.5.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1)

Go to the documentation to learn how to Fix dependency resolution errors.

how do I fix It?

like image 958
marites Lumboy Avatar asked Dec 22 '22 23:12

marites Lumboy


1 Answers

Try with

implementation("com.google.android.gms:play-services-gcm:$project.playServicesVersion") {
    exclude group: 'com.google.android.gms'
}

You can Try including one by one the one which brings errors you apply

 implementation("**API**") {
    exclude group: 'com.google.android.gms'
}

NB $project.playServicesVersion could be any of your versions you are using

like image 153
joash Avatar answered Jan 13 '23 13:01

joash