The introduction of implementation 'com.google.android.gms:play-services-ads:22.1.0' triggered a series of problem resolution records.
1. Package conflict: CheckDuplicatesRunnable Duplicate class
What went wrong:
Execution failed for task ':app:checkStreamingtvPRODDebugDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.google.android.gms.internal.measurement.zzhx found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zzna found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zznb found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zznc found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.internal.measurement.zznd found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzga found in modules jetified-play-services-measurement-19.0.1-runtime (com.google.android.gms:play-services-measurement:19.0.1) and jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2)
Duplicate class com.google.android.gms.measurement.internal.zzhe found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhf found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhg found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhh found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhi found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzhj found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzio found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Duplicate class com.google.android.gms.measurement.internal.zzit found in modules jetified-play-services-measurement-base-20.1.2-runtime (com.google.android.gms:play-services-measurement-base:20.1.2) and jetified-play-services-measurement-impl-19.0.1-runtime (com.google.android.gms:play-services-measurement-impl:19.0.1)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
Solution: exclude one of the duplicate packages
configurations.all {
// exclude group:'com.google.android.gms.measurement.internal',module:'play-services-measurement-base'//20.1.2
exclude group:'com.google.android.gms',module:'play-services-measurement-impl'
exclude group:'com.google.android.gms',module:'play-services-measurement'
}
2. Compiled version does not match (minCompileSdk)
Solution: Force the use of a lower version
configurations.all {
resolutionStrategy {
force 'androidx.browser:browser:1.3.0'//focus
force 'androidx.work:work-runtime:2.7.0-alpha05'
// force 'androidx.work:work-runtime:2.7.1'
// force 'androidx.work:work-runtime-ktx:2.7.1'
}
// exclude group:'com.google.android.gms.measurement.internal',module:'play-services-measurement-base'//20.1.2
exclude group:'com.google.android.gms',module:'play-services-measurement-impl'
exclude group:'com.google.android.gms',module:'play-services-measurement'
}
3. Target S+, PendingIntent problem
2023-07-27 10:47:08.959 13550-13572/? E/AndroidRuntime: FATAL EXCEPTION: pool-4-thread-1
Process: com.vod.droid.mixtv, PID: 13550
java.lang.IllegalArgumentException: com.vod.droid.mixtv: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:408)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:688)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:675)
at androidx.work.impl.utils.ForceStopRunnable.b(SourceFile:4)
at androidx.work.impl.utils.ForceStopRunnable.run(SourceFile:31)
at a.f0.r.p.h$a.run(SourceFile:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
Solution: androidx.work:work-runtime version problem can be solved by specifying this version.
force 'androidx.work:work-runtime:2.7.0-alpha05'
4. Didn't find class “com.google.android.gms.measurement.internal.zzfs”
Failed to load IDynamiteLoader from GmsCore: Application package com.google.android.gms not found
E FATAL EXCEPTION: ScionFrontendApi
Process: com.vod.droid.mixtv, PID: 11197
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/measurement/internal/zzfs;
at com.google.android.gms.measurement.internal.AppMeasurementDynamiteService.initialize(com.google.android.gms:play-services-measurement-sdk@@19.0.1:2)
at com.google.android.gms.internal.measurement.zzcx.zza(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:12)
at com.google.android.gms.internal.measurement.zzdt.run(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.internal.zzfs" on path: DexPathList[[zip file "/data/app/com.vod.droid.mixtv-2wwH2oxUBXOBXP6xY0jlhg==/base.apk"],nativeLibraryDirectories=[/data/app/com.vod.droid.mixtv-2wwH2oxUBXOBXP6xY0jlhg==/lib/arm, /data/app/com.vod.droid.mixtv-2wwH2oxUBXOBXP6xY0jlhg==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.gms.measurement.internal.AppMeasurementDynamiteService.initialize(com.google.android.gms:play-services-measurement-sdk@@19.0.1:2)
at com.google.android.gms.internal.measurement.zzcx.zza(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:12)
at com.google.android.gms.internal.measurement.zzdt.run(com.google.android.gms:play-services-measurement-sdk-api@@20.1.2:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Solution:
The actual search has this kind of
Package conflict removal: exclude group:'com.google.android.gms',module:'play-services-measurement-sdk'