我正在尝试更新我的 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) 我有一个应用程序,其部署目标是 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,对此有什么好的解决方案吗?
感谢您的帮助