firebase-unity-sdk: [Bug] Unable to build AAB with enabled setting "Split application binary"

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2022, 2023
  • Firebase Unity SDK version: 10.5, 10.6, maybe also early releases
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: I think any ( for sure Analytics, I used it for tests)
  • Other Firebase Components in use: no
  • Additional SDKs you are using: no
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP
  • Pre-built SDK from the website or open-source from this repo: website

[REQUIRED] Please describe the issue here:

When I’m trying to build an AAB file with the enabled setting “Split application binary” I’m facing errors, telling me about duplicate classes.

Im not sure, if this bug is related to Firebase SDK or to Unity. If this issue is not related to the Firebase SDK - tell me, ill create a ticket somewhere on the Unity side. Below is additional information to help understand the problem.

I tried to reproduce it on different Unity versions : 2021 - Success. 2022, 2023 - FAIL.

I tried to reproduce it with different settings : Build AAB, “Split application binary” is enabled - FAIL. Build AAB, “Split application binary” is disabled - Success. Build APK, “Split application binary” is enabled - Success. Build APK, “Split application binary” is disabled - Success.

Log :

`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.😇 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.😇 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.😇 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.😇 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.😇 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.😇 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.😇 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.😇 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.😇 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.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.ResultCallback found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.ResultCallbacks found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.Scope found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.Status found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.UnsupportedApiCallException found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.BackgroundDetector found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.BackgroundDetector$BackgroundStateChangeListener found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.GoogleServices found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.LifecycleActivity found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.LifecycleCallback found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.LifecycleFragment found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.StatusExceptionMapper found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.zza found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 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.internal.zzb found in modules com.google.android.gms.play-services-basement-18.1.0-runtime (:com.google.android.gms.play-services-basement-18.1.😇 and play-services-basement-16.0.1-runtime (com.google.android.gms:play-services-basement:16.0.1)`

Steps to reproduce:

  1. Create a new Unity android project
  2. Add Firebase Analytics component.
  3. In player settings enable “Split application binary”
  4. In build settings enable “Build App Bundle”
  5. In build settings press the “Build” button

Relevant Code:

sc

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

@RaoulRb12 @streaminspace

I think both of you are experiencing the same issue mentioned here. https://github.com/googlesamples/unity-jar-resolver/issues/594

Key way to identify this is some message like

Could not find com.xxx.xxx
Searched in the following locations:

Basically, Unity changed the place to specify Maven Repo from mainTemplate.gradle to settingsTemplate.gradle from Unity 2022.2+ . And this change in EDM4U should fixed it.

I am working on a release once I sort out all the failed test in EDM4U.

At the meantime, here is my recommendation

  1. Upgrade to Unity 2022.2.10+ if you are using Unity 2022.2. Unity 2022.2.1 to 2022.2.9 has bugs that template variable like **DIR_UNITYPROJECT** does not work in settingsTemplate.gradle. If you HAVE to use those versions, convert all local custom Maven repo paths to full absolute path like /user/someone/path/to/unity_project\... or C:\User\someone\path\to\unity_project\... for what will be described in the next part.
  2. Enable Custom Settings Gradle Template, which is added in 2022.2.10 and 2023.1. And move all Maven repos added in mainTemplate.gradle to that dependencyResolutionManagement block. You can see this as an example. Would be great if you can keep that // Android Resolver Repos Start and // Android Resolver Repos End lines so that newer version of EDM4U can patch this block properly for you.

Let me know if this works for you.

the fix from Unity that works for me (I use only GooglePlayGames and GoogleMobileAds plugins):

1 - clean up all aar and jar files and also their metafiles from Assets/Plugins/Android folder 2 - delete Library/Bee/Android/Prj/IL2CPP/Gradle folder 3 - open project 4 - check that Custom Main Gradle Template, Custom Gradle Settings Template, Custom Gradle Properties Template are turned on in Player settings 5 - run Assets/Eternal Dependency Manager/Android Resolver/Resolve (it should end immediately, there should be no new files in Assets/Plugins/Android appear) 6 - build AAB

Hi @streaminspace,

Thanks for reporting this issue. I was able to reproduce this issue on my end using version 10.6.0 of the SDK on a 2023 version of the Unity editor. That said, I’ll be relaying my observations to the team, and I’ll let you know of any updates via this thread. For now, let me mark this as a bug.