我正在try 更新我的一个Android项目的依赖项,我遇到了这个奇怪的错误.

罪魁祸首是这一行,对于AdMob(我以前使用的是20.6.0):

implementation "com.google.android.gms:play-services-ads:21.0.0"

我犯了一系列错误:

复制类com.谷歌.安卓gms.内部的测量zzhx位于模块jetified-play-services-measurement-base-20.1.2-runtime(com.google.android.gms:play-services-measurement-base:20.1.2)和jetified-play-services-measurement-impl-20.1.1-runtime(com.google.android.gms:play-services-measurement-impl:20.1.1)中

复制类com.谷歌.安卓gms.内部的测量zzna位于模块jetified-play-services-measurement-base-20.1.2-runtime(com.google.android.gms:play-services-measurement-base:20.1.2)和jetified-play-services-measurement-impl-20.1.1-runtime(com.google.android.gms:play-services-measurement-impl:20.1.1)中

复制类com.谷歌.安卓gms.内部的测量zznb位于模块jetified-play-services-measurement-base-20.1.2-runtime(com.google.android.gms:play-services-measurement-base:20.1.2)和jetified-play-services-measurement-impl-20.1.1-runtime(com.google.android.gms:play-services-measurement-impl:20.1.1)中

复制类com.谷歌.安卓gms.内部的测量zznc位于模块jetified-play-services-measurement-base-20.1.2-runtime(com.google.android.gms:play-services-measurement-base:20.1.2)和jetified-play-services-measurement-impl-20.1.1-runtime(com.google.android.gms:play-services-measurement-impl:20.1.1)中

...

以下是我在项目build.gradle (:app)中使用的所有依赖项:

dependencies {
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    // Firebase & Crashlytics
    implementation platform('com.google.firebase:firebase-bom:29.2.1')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    //Navigation
    implementation "androidx.navigation:navigation-fragment-ktx:2.4.2"
    implementation "androidx.navigation:navigation-ui-ktx:2.4.2"
    // AdMob
    implementation "com.google.android.gms:play-services-ads:21.0.0"
    // Style
    implementation 'com.intuit.sdp:sdp-android:1.0.5'
    // Play Core
    implementation 'com.google.android.play:core:1.10.3'
    implementation 'com.google.android.play:core-ktx:1.8.1'
    // Billing
    implementation "com.android.billingclient:billing-ktx:5.0.0"
}

以及build.gradle (My App)中的依赖项:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.1.3"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.2"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
        classpath "com.google.gms:google-services:4.3.10"
        classpath "com.google.firebase:firebase-crashlytics-gradle:2.8.1"
    }
}

导致此错误的原因是什么?如果将play-services-ads还原为20.6.0,则不会出现任何错误.

谢谢你的帮助

推荐答案

您还需要更新

 implementation platform('com.google.firebase:firebase-bom:30.1.0')

Android相关问答推荐

以正确的方式从房间收集流量

如何让用户与我的应用生成的多个音频文件交互

如何检测HitTest是否命中给定的网格对象?

Android开发:主题排版不适用于按钮文本

Android 14(Oneui 6)中的本地推送通知行为不一致

Android Gradle/Groovy,如何将文件复制到APK

在命令行Android应用程序开发中苦苦挣扎

找不到com.android.tools.build:gradle:8.0

如何将.txtassets资源 转换为ArrayList<;字符串>;kotlin格式?

如何判断堆肥是否为空?

Android 14预测性背部手势-闪烁的白色背景色

如何使用react native下载android中/data/data/[应用程序包名称文件夹]/files中的文件

Android WebView 不会在滚动端加载新内容

修复报错 RecyclerView: No adapter attached;跳过布局

Jetpack compose :使用 rememberSaveable 时未应用待处理的合成

获取 ArithmeticException:除以零,但我没有在任何地方除以零

自定义 Compose Arrangement 以在 LazyRow/LazyColumn 的开头和结尾添加额外的间距

前台服务通知需要几秒钟才能显示

Android Jetpack Compose - 每次文本字段值更改时,可组合函数都会重新组合

Jetpack Compose:如何绘制这样的路径/线