小编Dan*_*ase的帖子

Android:在 jetified-play-services-measurement 和 jetified-play-services-measurement-impl 模块中发现重复的类

我正在尝试更新我的 Android 项目之一的依赖项,但收到了这个奇怪的错误。

罪魁祸首是 AdMob 的这一行(我之前使用的是 20.6.0):

implementation "com.google.android.gms:play-services-ads:21.0.0"
Run Code Online (Sandbox Code Playgroud)

我收到一堆错误:

在模块 jetified-play-services-measurement-base-20.1.2-runtime 中发现重复的类 com.google.android.gms.internal.measurement.zzhx (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)

在模块 jetified-play-services-measurement-base-20.1.2-runtime 中发现重复的类 com.google.android.gms.internal.measurement.zzna (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)

在模块 jetified-play-services-measurement-base-20.1.2-runtime 中发现重复的类 com.google.android.gms.internal.measurement.zznb (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)

在模块 jetified-play-services-measurement-base-20.1.2-runtime 中发现重复的类 com.google.android.gms.internal.measurement.zznc (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 …
Run Code Online (Sandbox Code Playgroud)

android gradle

45
推荐指数
2
解决办法
3万
查看次数

iOS:并发仅在 iOS 15.0.0 或更高版本的协议中可用

我有一个应用程序,其部署目标是 iOS 12.1,其中许多协议定义带有完成处理程序的函数,即

protocol P {
    func f(_ completion: @escaping: (String) -> Void)
}
Run Code Online (Sandbox Code Playgroud)

我想用新的 async/await iOS 15 语法替换所有这些,以获得更好的代码可读性:

protocol P {
    func f() async -> String
}
Run Code Online (Sandbox Code Playgroud)

但这样做时,我收到错误:

并发仅在 iOS 15.0.0 或更高版本中可用

考虑到我无法将部署目标从 12.1 切换到 15.0,对此有什么好的解决方案吗?

感谢您的帮助

concurrency deployment-target ios swift

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1

concurrency ×1

deployment-target ×1

gradle ×1

ios ×1

swift ×1