# #android #firebase #kotlin #android-gradle-plugin #crashlytics
Вопрос:
Я выполнил шаги по установке Firebase и Crashlytics в проект, такие как добавление google-services.json, правильных плагинов и зависимостей, и всякий раз, когда я пытаюсь скомпилировать, я сталкиваюсь со следующим выводом ошибок:
Duplicate class com.google.android.gms.common.api.internal.zza found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Duplicate class com.google.android.gms.common.api.internal.zzb found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Duplicate class com.google.android.gms.common.api.internal.zzc found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Duplicate class com.google.android.gms.common.api.internal.zzd found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Duplicate class com.google.android.gms.common.api.zza found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Duplicate class com.google.android.gms.common.api.zzb found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Duplicate class com.google.android.gms.common.internal.zzb found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Duplicate class com.google.android.gms.common.internal.zzc found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.0.0-runtime (com.google.android.gms:play-services-basement:17.0.0) Go to the documentation to learn how to Fix dependency resolution errors.
Эта ошибка исчезает, когда я комментирую следующие строки:
implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.google.firebase:firebase-crashlytics-ktx'
Вот все зависимости моего проекта build.gradle:
dependencies { classpath 'com.android.tools.build:gradle:4.2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0" classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
и это мои зависимости на уровне приложений:
dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.5.0' implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4. ' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' implementation "androidx.fragment:fragment-ktx:1.3.4" implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation "androidx.activity:activity-ktx:1.2.3" implementation "androidx.viewpager2:viewpager2:1.0.0" implementation platform('com.google.firebase:firebase-bom:29.0.0') implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.google.firebase:firebase-crashlytics-ktx' implementation "com.squareup.retrofit2:retrofit:2.9.0" implementation "com.squareup.retrofit2:adapter-rxjava2:2.6.2" implementation "com.squareup.retrofit2:converter-gson:2.9.0" implementation 'com.google.code.gson:gson:2.8.7' implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.8.1' implementation 'com.squareup.okhttp3:okhttp:3.14.9' implementation 'com.kofigyan.stateprogressbar:stateprogressbar:1.0.0' implementation 'com.github.arcadefire:nice-spinner:1.4.4' implementation 'com.jaredrummler:material-spinner:1.3.1' //Font Solution implementation 'io.github.inflationx:calligraphy3:3.1.1' implementation 'io.github.inflationx:viewpump:2.0.3' implementation 'me.saket:better-link-movement-method:2.2.0' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' implementation 'com.github.bumptech.glide:glide:4.11.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' implementation 'com.braintreepayments.api:drop-in:5.1.0' implementation 'com.braintreepayments.api:braintree:3.16.1' implementation 'com.google.android.play:core:1.10.2' implementation 'com.google.android.play:core-ktx:1.8.1' implementation 'com.airbnb.android:lottie:3.6.1' implementation 'com.yoti.mobile.android.sdk:yoti-sdk-doc-scan:2.6.0' implementation 'com.facebook.android:facebook-login:9.1.1' //For Bullet Lists implementation 'com.github.fueled:snippety:1.1.1' implementation 'com.realexpayments.hpp.sdk:rxp-hpp-android:2.0' implementation 'com.github.corouteam:GlideToVectorYou:v2.0.0' implementation "org.jetbrains:markdown:0.2.4" implementation 'com.github.forresthopkinsa:StompProtocolAndroid:17.11.0' }
Комментарии:
1. Применили ли вы плагин ‘id ‘com.google.gms.google-сервисы’ ‘