Build Failure with .aab file due to Execution failed for task ':launcher:checkReleaseDuplicateClasses' after upgrading to IAP 4.12.*

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2023.2.3f1
  • External Dependency Manager version: 1.2.182
  • Source you installed EDM4U: Unity Package Manager
  • Features in External Dependency Manager in use: Android Resolver
  • Plugins SDK in use: Firebase, Google Mobile Ads, Google Sign In
  • Platform you are using the Unity editor on: Windows

SOURCES:

  1. Google Mobile Ads: Google Mobile Ads v9.2.0
  2. Google Sign In: Google Sign in v.1.0.4
  3. Firebase: Firebase v11.7.0

[REQUIRED] Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

We received a warning from Google Play Console stating that our app must use Google Play Billing Library version 6.0.1 or later. Currently, the IAP package in our app is version 4.11.0, which only supports Google Play Billing Library version 5.2.1. Therefore, we decided to upgrade the IAP package to version 4.12.0 or higher to support Google Play Billing Library version 6.0.1 in Unity. However, when building the Android App Bundle (.aab) file, we encountered the following error:

Note: D:\Game Projects\Team Startup\Jigsaw - revert\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build 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.5.0-runtime (androidx.core:core:1.5.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.5.0-runtime (androidx.core:core:1.5.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.5.0-runtime (androidx.core:core:1.5.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.5.0-runtime (androidx.core:core:1.5.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.5.0-runtime (androidx.core:core:1.5.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.5.0-runtime (androidx.core:core:1.5.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.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$1 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$2 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$2$1 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$2$2 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$3 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$4 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$5 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ComponentActivity$NonConfigurationInstances found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.ImmLeaksCleaner found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.OnBackPressedCallback found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcher found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcher$LifecycleOnBackPressedCancellable found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcher$OnBackPressedCancellable found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.OnBackPressedDispatcherOwner found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.contextaware.ContextAware found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.contextaware.ContextAwareHelper found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.contextaware.OnContextAvailableListener found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResult found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResult$1 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultCallback found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultCaller found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultLauncher found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultRegistry found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultRegistry$1 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultRegistry$2 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultRegistry$3 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultRegistry$CallbackAndContract found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultRegistry$LifecycleContainer found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.ActivityResultRegistryOwner found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.IntentSenderRequest found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.IntentSenderRequest$1 found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.IntentSenderRequest$Builder found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContract found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContract$SynchronousResult found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$CreateDocument found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$GetContent found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$GetMultipleContents found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$OpenDocument found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$OpenDocumentTree found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$OpenMultipleDocuments found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$PickContact found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$RequestMultiplePermissions found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$RequestPermission found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$StartActivityForResult found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$StartIntentSenderForResult found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$TakePicture found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$TakePicturePreview found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.0:)
     Duplicate class androidx.activity.result.contract.ActivityResultContracts$TakeVideo found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.2.0-runtime (:androidx.activity.activity-1.2.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.<message truncated>

I have tried several methods to resolve the issue, but the error persists when building the project. Here’s what I’ve attempted so far:

  1. Deleted the library folder of the project to allow Unity to regenerate all files automatically.
  2. Used Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries - Force Resolve.
  3. Tested with newer versions of the IAP package.
  4. Installed the latest version of the External Dependency Manager.

However, none of these solutions have worked. We had to request an extension from Google Play Console for the warning, pushing the deadline to November. It seems that some other developers are also encountering similar issues as we are
[Android] Build fails with Error “A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable” when using In-App Purchasing and Facebook SDK
669 653

Issue repro rate: 100%

Hey @nguyenthaibao3303, have you tried the solutions in the pinned discussion?

I tried enabling Patch mainTemplate.gradle and copying and patching settingsTemplate.gradle from 2022.2, then forcing the solver. It’s great that I was able to build, but all the .arr files in Android/Plugins were deleted. Does this cause any issues?

Before

After

image

Take backup after doing anything…

My request is try to uninstall IAP and reinstall IAP package 4.12.2 which is latest version. Important notice “ install package by name”.

Follow below videos. These videos helped many people.

1.) Google play billing library migrate to 6.+ in 2024 | Google Play Console Privacy | Unity IAP Manager

2.) Gradle Build Failed Error API Level 34 in Unity | 100% Solve After Updating Targeting API Level 2024

Let me know it’s working or not.

I have the same issue with the conflicts, but I cant use the solution you mentionned because enabling Custom Main Gradle cause an error in Google Jar Resolver.
I made an Issue about it here : [Bug] NullReferenceException: Object reference not set to an instance of an object Google.JarResolver.Dependency.IsGreater · Issue #712 · googlesamples/unity-jar-resolver · GitHub

Is your project imported using .unitypackage ?

I tried following the video above, initially the IAP version in our game was 4.11.0 then we removed and reinstalled version 4.12.0 as in the video. We force resolved and rebuilt but still encountered the duplicate error. I tried many ways, I feel like many people have encountered this error, not just me. Hopefully the upcoming update of IAP can clearly resolve this problem.

I’m pretty confident that yes

Please take backup before doing anything. Click on your error click that says that you have to safely delete EDM4U

I fixed my issue

Use unityPakcage instead of UPM registry and use minimum API 24 and target highest possible API (35 in my case)

1 Like