I’m trying to build an .aab with splitted binary - witch results now in a DuplicatesRunnable Error. I guess there is something wrong with gradle, as I do not have the mentioned .aar files in my project.
Furthermore I have no custom gradle templates in use.
The problems sounds very similar to this one.
Just that I’m using the lates PlayGames plugin, and not Firebase.
Anybody else with this bug? I tried the latest Unity 2023 and 2022.
Forcing Jetifier and androidx in a gradle properties template results in a similar error.
E.g. I have in my project the
androidx.core.core-1.2.0 AAR - and the mentioned duplicate support-compat-26.1.0 AAR was added by gradle when building the AAB. I’ve found the duplicate in the gradle cache directory.
stderr[
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.INotificationSideChannel found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules androidx.core.core-1.2.0-runtime (:androidx.core.core-1.2.0:) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class com.google.android.gms.actions.ItemListIntents found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.actions.NoteIntents found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.actions.ReserveIntents found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.actions.SearchIntents found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.AccountPicker found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.BlockingServiceConnection found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.ConnectionResult found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.Feature found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.FirstPartyScopes found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.GoogleApiAvailabilityLight found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.GooglePlayServicesNotAvailableException found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.GooglePlayServicesRepairableException found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.GooglePlayServicesUtilLight found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.GoogleSignatureVerifier found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.ProGuardCanary found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.Scopes found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.UserRecoverableException found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.annotation.KeepForSdk found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.annotation.KeepForSdkWithFieldsAndMethods found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.annotation.KeepForSdkWithMembers found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.annotation.KeepName found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.api.ApiException found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.api.CommonStatusCodes found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.api.Releasable found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.api.ResolvableApiException found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.api.ResolvingResultCallbacks found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.api.Response found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)
Duplicate class com.google.android.gms.common.api.Result found in modules com.google.android.gms.play-services-basement-18.0.0-runtime (:com.google.android.gms.play-services-basement-18.0.0:) and play-services-basement-16.0.1-runtime
And, as I do not use a custom template - I had to alter the template created by Unity via IPostGenerateGradleAndroidProject in the following C# AndroidPostBuildProcessor.cs script:
using System.IO;
using UnityEditor.Android;
using UnityEngine;
public class AndroidPostBuildProcessor : IPostGenerateGradleAndroidProject
{
public int callbackOrder
{
get
{
return 999;
}
}
void IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject(string path)
{
Debug.Log("Bulid path : " + path);
string gradlePropertiesFile = path + "/build.gradle";
string content = File.ReadAllText(gradlePropertiesFile);
if (!content.Contains("configurations.implementation"))
{
content += "\r\nconfigurations.implementation {\r\n exclude(group : \"com.android.support\")\r\n\texclude(group : \"com.google.android.gms\")\r\n}";
File.WriteAllText(gradlePropertiesFile, content);
}
}
}
Now I can build APK and AAB with splitted application binaries again.
The type name 'AndroidJavaProxy' could not be found in the namespace 'UnityEngine'.
This type has been forwarded to assembly 'UnityEngine.AndroidJNIModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
Enable the built in package 'Android JNI' in the Package Manager window to fix this error.
You can build with this combination successfully, but not with enabled “Split Application Binary”.
Then you get this “checkReleaseDuplicateClasses Exception”.
For me it was some of these errors (First I got actual the same error as the thread author, but with enabled custom gradle this different one)
android.support.v4.graphics.drawable.IconCompatParcelizer
found in
modules core-1.0.0-runtime (androidx.core:core:1.0.0)
and
jetified-androidx.core.core-1.2.0-runtime (androidx.core.core-1.2.0)```
So "androidx.core:core:1.0.0" is actual from the package [com.unity.modules.androidjni](https://docs.unity3d.com/Manual/com.unity.modules.androidjni.html) and "androidx.core.core-1.2.0" from [PlayGameServices](https://github.com/playgameservices/play-games-plugin-for-unity).
Thank you very much @Axel-F for sharing this! I also had this issue: in a project with Firebase (like the link in your first post). I wasn’t able to solve it with the approach discussed in that link, but your fix solved things for me.
@Axel-F Have you submitted an official Unity Bug Report for this? Hopefully this can be fixed for 2022.3 LTS.
I don’t understand the full impact of excluding those groups, and where potential issues might appear for thorough testing and QA. So far, all of the services/features in my app appears to be functioning as expected. If you could share any thoughts around that, I’d be grateful!
Cause: Starting with Unity 2022, the PlayCore library changes from com.google.android.play:core:1.10.0 → com.google.android.play:asset-delivery:2.0.0.
com.google.android.play:asset-delivery:2.0.0 is using play-services-basement:16.0.1.
And a library added elsewhere uses play-services-basement-18.0.0.
The two dependency libraries conflict with each other.
Almost same problem, but nothing helped Maybe someone give me some intel on how to solve it?
java.lang.RuntimeException: Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.2-runtime.jar (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.2-runtime.jar (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.2-runtime.jar (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.2-runtime.jar (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.1-runtime.jar (com.google.android.play:review:2.0.1)
Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.1-runtime.jar (com.google.android.play:review:2.0.1)
Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.1-runtime.jar (com.google.android.play:review:2.0.1)
Duplicate class com.google.android.play.core.review.model.ReviewErrorCode found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.1-runtime.jar (com.google.android.play:review:2.0.1)
Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.1-runtime.jar (com.google.android.play:review:2.0.1)
If you’re on Unity 2022+ it might help to activate the custom gradle properties, custom gradle settings and custom gradle template in the Publishing settings
I look at com.google.android.play:version, can you check, maybe your project have 2 versions of one plugin? If yes - try to delete one of them, it should help.
Posting this as future help for others, here is a slightly modified version of @Axel-F 's code:
using System.IO;
#if UNITY_EDITOR
using UnityEditor.Android;
public class AndroidPostBuildProcessor : IPostGenerateGradleAndroidProject
{
public int callbackOrder => 999;
void IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject(string path)
{
UnityEngine.Debug.Log("Bulid path : " + path);
string gradlePropertiesFile = path + "/build.gradle";
string content = File.ReadAllText(gradlePropertiesFile);
int index = content.IndexOf("configurations.implementation");
if (index >= 0) content = content[0..index];
content += "\r\n" +
"configurations.implementation " +
"{\r\n " +
"exclude(group : \"com.android.support\")\r\n" +
"exclude(group : \"com.google.android.gms\")\r\n" +
"exclude(group : \"com.google.android.play\")\r\n" +
"}";
File.WriteAllText(gradlePropertiesFile, content);
}
}
#endif
All I changed is the way Unity’s gradle file is updated, before it was updated only for the first time you tried to build the game. In my case, I was missing “exclude(group : “com.google.android.play”)” attribute which wasn’t added afterwards due to this if statement:
if (!content.Contains("configurations.implementation"))
Try this out if you are still getting errors with "com.google.android.play" library! Again big thanks to @Axel-F for finding this out!
Hello… Similar problem here. I’m using Unity 2021.3.24.
The only package I imported from Google Play is the integrity one.
Build has no errors if “Split Application Binary” is unchecked, but then it fails on the backend due to the size being over 150MB.
If “Split Application Binary” is checked, I get the following error while building:
If I follow what’s suggested, I get an error on console, saying “Resolve Failed” and suggests me to check also Custom Gradle Properties Template. So I check also that (therefore in my Publish Settings I’ve both Custom Main Gradle and Custom Gradle Properties checked).
Then all the plugins are wiped away from the plugins/Android folder, and just the two templates are there (gradleTemplate and mainTemplate).
If I build that way, I get no errors, but my app doesn’t include the android libraries, and when requesting an integrity token, I get this error in the android logcat: “java.lang.ClassNotFoundException: com.google.android.play.core.integrity.IntegrityManagerFactory” which indicates that the plugin is not there.
What am I doing wrong and how can I solve it?
I read on this thread about the AndroidPostBuildProcessor… Shall I change something there and exclude the integrity (“com.google.play.integrity”)? Or am I doing something wrong with that script or how to use it (not sure where to put exactly the configuration lines on my mainTemplate)? Can someone give me some guidance?