Mehdi Nafa
Mehdi Nafa

Reputation: 11

Duplicate class problem when migrating from gms places to places-apcompat

These are my implementations entrise un app build.gradle

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.android.libraries.places:places:2.0.0'
implementation ('com.google.android.libraries.places:places-compat:2.0.0'){
    exclude group:"com.google.android.libraries.places:places-compat", module: "AutocompleteActivity"
}
implementation 'com.firebase:geofire-android:3.0.0'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.10.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

apply plugin: 'com.google.gms.google-services'


And this is the build error I have:

Duplicate class com.google.android.libraries.places.widget.AutocompleteActivity found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zza found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zzb found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zzc found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0) Duplicate class com.google.android.libraries.places.widget.zzd found in modules classes.jar (com.google.android.libraries.places:places-compat:2.0.0) and classes.jar (com.google.android.libraries.places:places:2.0.0)

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


Any hints? Thank you in advance!

Upvotes: 1

Views: 76

Answers (1)

sagar adhikari
sagar adhikari

Reputation: 281

Remove this from your gradle file:

implementation ('com.google.android.libraries.places:places-compat:2.0.0'){
    exclude group:"com.google.android.libraries.places:places-compat", module: "AutocompleteActivity"
}

I've solved my problem removing this line.

Upvotes: 0

Related Questions