Updated to Unity IAP package 4.12.2 Caused build errors

Hey,
I updated my iap package to 4.12.2 and now I can’t build anymore because I get this error

* 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.ActivityViewModelLazyKt found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.ActivityViewModelLazyKt$viewModels$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.ActivityViewModelLazyKt$viewModels$factoryPromise$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.Api19Impl found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.Api26Impl found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.ComponentActivity$Api19Impl found in modules jetified-activity-1.3.1-runtime (androidx.activity:activity:1.3.1) and jetified-androidx.activity.activity-1.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.OnBackPressedDispatcherKt found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-1.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.OnBackPressedDispatcherKt$addCallback$callback$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-1.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.PipHintTrackerKt found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.PipHintTrackerKt$trackPipAnimationHintView$flow$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.PipHintTrackerKt$trackPipAnimationHintView$flow$1$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.PipHintTrackerKt$trackPipAnimationHintView$flow$1$attachStateChangeListener$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.contextaware.ContextAwareKt found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-1.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.contextaware.ContextAwareKt$withContextAvailable$2$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-1.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.contextaware.ContextAwareKt$withContextAvailable$2$listener$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-1.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.result.ActivityResultCallerKt found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.result.ActivityResultCallerLauncher found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.result.ActivityResultCallerLauncher$resultContract$2 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.result.ActivityResultCallerLauncher$resultContract$2$1 found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     Duplicate class androidx.activity.result.ActivityResultKt found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     Duplicate class androidx.activity.result.ActivityResultLauncherKt found in modules jetified-activity-ktx-1.3.1-runtime (androidx.activity:activity-ktx:1.3.1) and jetified-androidx.activity.activity-ktx-1.7.1-runtime (:androidx.activity.activity-ktx-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.activity.activity-1.7.1:)
     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.7.1-runtime (:androidx.a<message truncated>
CommandInvokationFailure: Gradle build failed. 

I am not sure how to solve it :confused: and after searching for a few hours its seems that I am not the only one that has this problem

3 Likes

I have same issue

I followed this post and solved the issue

Look like we need to do Delete Resolved Libraries before build.

Thanks, I tried it and it won’t work i still get the errors

and if I Delete Resolved Libraries and then build it will create the apk but it will crash and won’t open

It’s broken and has been for weeks now. It’s super frustrating with IAP releasing multiple new versions during that time and Google Builds are STILL broken. This is restricting Google Play Users from updating to the mandatory Google BIlling Library 6 next month.

3 Likes

I updated a project without any issues, I suspect the problems come from EDM4U or other Android plugins in the project. Did you check the various issues on GitHub and the advice in them (make sure Jetifier is enabled, custom templates are enabled, cleaned all existing libraries, etc)?

(Honestly, EDM4U is an overcomplicated mess and I don’t use it. It’s much cleaner to use custom android library projects in Unity [.androidlib], export a gradle project, and then build using gradle / Android Studio. This makes debugging issues like this much easier, since at that point it’s a normal Android project and you can inspect all the configuration.)

1 Like

it won’t work i still get the errors

Then I’d try to reproduce it in a new project. If you can, report a bug – if it works, try to find the crucial difference to your existing project.

I removed one of the Google plugins I was using, and 4.12.2 seems to be building successfully. I’ve submitted a version to Google Play without the plugin for now, and will have to figure out how to re-integrate it in a future version. I only use auto-renewing subscriptions, so I’m not sure if consumables/etc are still bugged. Also, haven’t tested it on iOS yet

My Project version is 2020.3.45f1. I install In App Purchasing 4.12.2, and I can’t see the Services option on top menu, is this normal? because if I can’t click the services button, I don’t know how to create iap button.

I still have this problem and I cant find any fix for it :confused:

I have same issue too.

Which Unity version are you using?
If it has been a while since you updated, updating Unity may solve the problem.

Updated firebase 11.3.0 to 11.5.0 solved the issue, but now UnityPurchasing.Initialize() is not calling the OnInitialized or OnInitializeFailed methods …

In App Purchasing 4.12.2 also has problems. I think it conflicts with Google play game sdk. I got a build error after installing the GooglePlayGamesPlugin-0.11.01 package. Developer… please fix it quickly.

What error did you get? I’m getting a different one with mine, ever since I updated to IAP 4.12. Just curious if your error is the same as mine, or the same as the original poster’s.

It took me some steps to build my game again after updating the IAP… I was able to solve the problems by doing this:

  1. go to Edit > Project settings > Player > Android Tab > Publishing settings > Build > select Custom main grade template and also custom grade settings template

  2. go to [projectDirectory]\Assets\Plugins\Android and edit the gradleTemplate.properties.
    add this in the end of file (if not there already):
    android.useAndroidX=true
    android.enableJetifier=true

  3. go to Assets > External dependecy manager > android resolver > click Delete resolved libraries

  4. go to [projectDirectory]\Assets\Plugins\Android again and check if the libraries are deleted. if not, delete them. i just kept the gradle files and GooglePlayGamesManifest.androidlib
    (i saw this at [Bug] Execution failed for task ':launcher:checkReleaseDuplicateClasses'. · Issue #626 · googlesamples/unity-jar-resolver · GitHub)

  5. go to Assets > External dependecy manager > android resolver > Force

1 Like

This solution worked for me, if it works for you, share it in the other forums to help everyone, please.

nothing worked for me please help
im using iap v 4.12.2
googlemobileads v9.2
firebase v12.0

how to solve this!!!

1 Like

See the following discussion link.
I was able to successfully build.

Do what @unity_psBBuKYnBt2RIg and @Alkanov had posted there. I did both of what they recommended. I had to delete the “Library” folder too (when restarting Unity, the Library folder will be rebuilt)

https://discussions.unity.com/t/after-updating-iap-to-4-12-2-an-error-occurs-in-android-build/1502616/15