I added firebase to android. It used to work fine but after pulling from github it shows the errors below:
Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:17.2.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:17.2.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:17.2.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:17.2.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:17.2.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1)
I tried deleting a few lines in gradle file but it doesn't seem to work.
My gradle file is:
apply plugin: 'com.android.application' android { compileSdkVersion 29 buildToolsVersion "29.0.1" defaultConfig { applicationId "com.example.agrismart" minSdkVersion 23 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.firebaseui:firebase-ui-database:6.0.2' implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' implementation 'com.github.barteksc:android-pdf-viewer:2.8.2' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation'com.google.firebase:firebase-auth:18.1.0' implementation 'com.google.firebase:firebase-analytics:17.2.0' implementation 'com.google.firebase:firebase-database:19.1.0' implementation 'com.google.firebase:firebase-core:15.0.0' implementation 'com.firebase:firebase-client-android:2.4.0' implementation 'com.google.android.gms:play-services:10.0.1' } apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' How can I resolve these problems?
build.gradleis a mess and also uses age-old versions mixed with new versions.implementation 'com.firebase:firebase-client-android:2.4.0'.play-services:10.0.1andapply plugin: 'com.android.application'probably should be on top... also the conflict hints for duplicate play-services pulled in due to version mismatch.