androidunity-game-enginegoogle-play-servicesgoogleads-mobile-unity

Unity 2022.3.44f1 - Execution failed for task ':launcher:checkReleaseDuplicateClasses'


After updating my package with the latest Google Play SDK's (read: deleting all packages from Unity and re-adding the latest version, cause there is no other way to do this without a gazillion errors), I've run into the (hopefully, but who am I kidding) final error that prevents me to build:

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)

I've tried all kinds of resolutions that are on the internet, inc. removing and re-adding the external dependency manager. Alas, it keeps failing with this issue. What can I try next?

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.activity.Cancellable found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.ComponentActivity found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.ComponentActivity$1 found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.ComponentActivity$2 found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.ComponentActivity$3 found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.ComponentActivity$NonConfigurationInstances found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.ImmLeaksCleaner found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.OnBackPressedCallback found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcher found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcher$LifecycleOnBackPressedCancellable found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcher$OnBackPressedCancellable found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcherOwner found in modules jetified-activity-1.2.3-runtime (androidx.activity:activity:1.2.3) and jetified-androidx.activity.activity-1.0.0-runtime (:androidx.activity.activity-1.0.0:)
     Duplicate class androidx.arch.core.executor.ArchTaskExecutor found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
     Duplicate class androidx.arch.core.executor.ArchTaskExecutor$1 found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
     Duplicate class androidx.arch.core.executor.ArchTaskExecutor$2 found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
     Duplicate class androidx.arch.core.executor.DefaultTaskExecutor found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
     Duplicate class androidx.arch.core.executor.DefaultTaskExecutor$1 found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
     Duplicate class androidx.arch.core.executor.TaskExecutor found in modules core-runtime-2.1.0-runtime (androidx.arch.core:core-runtime:2.1.0) and jetified-androidx.arch.core.core-runtime-2.1.0-runtime (:androidx.arch.core.core-runtime-2.1.0:)
     Duplicate class androidx.arch.core.internal.FastSafeIterableMap found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.internal.SafeIterableMap found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.internal.SafeIterableMap$AscendingIterator found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.internal.SafeIterableMap$DescendingIterator found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.internal.SafeIterableMap$Entry found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.internal.SafeIterableMap$IteratorWithAdditions found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.internal.SafeIterableMap$ListIterator found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.internal.SafeIterableMap$SupportRemove found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.arch.core.util.Function found in modules core-common-2.1.0 (androidx.arch.core:core-common:2.1.0) and jetified-androidx.arch.core.core-common-2.1.0 (androidx.arch.core.core-common-2.1.0.jar)
     Duplicate class androidx.collection.ArrayMap found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.ArrayMap$1 found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.ArraySet found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.ArraySet$1 found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.CircularArray found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.CircularIntArray found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.ContainerHelpers found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.LongSparseArray found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.LruCache found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.MapCollections found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.MapCollections$ArrayIterator found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.MapCollections$EntrySet found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.MapCollections$KeySet found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.MapCollections$MapIterator found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.MapCollections$ValuesCollection found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.SimpleArrayMap found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.collection.SparseArrayCompat found in modules collection-1.1.0 (androidx.collection:collection:1.1.0) and jetified-androidx.collection.collection-1.1.0 (androidx.collection.collection-1.1.0.jar)
     Duplicate class androidx.core.accessibilityservice.AccessibilityServiceInfoCompat found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityCompat found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityCompat$1 found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityCompat$OnRequestPermissionsResultCallback found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityCompat$PermissionCompatDelegate found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityCompat$RequestPermissionsRequestCodeValidator found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityCompat$SharedElementCallback21Impl found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityManagerCompat found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityOptionsCompat found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityOptionsCompat$ActivityOptionsCompatImpl found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityRecreator found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityRecreator$1 found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityRecreator$2 found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityRecreator$3 found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ActivityRecreator$LifecycleCheckCallbacks found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.AlarmManagerCompat found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.AppComponentFactory found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.AppLaunchChecker found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.AppOpsManagerCompat found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.BundleCompat found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ComponentActivity found in modules core-1.2.0-runtime (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.9.0-runtime (:androidx.core.core-1.9.0:)
     Duplicate class androidx.core.app.ComponentActivity$ExtraData found in <message truncated>

Solution

  • Apparently, this was the fix: Enable templates in PlayerSettings->Android->Publish Settings:

    Main Gradle
    Gradle Properties
    Gradle Settings