Search Unity

Bug Can't build for Android because of duplicated asset entries

Discussion in 'Addressables' started by yusufdemir2012, Mar 10, 2023.

  1. yusufdemir2012

    yusufdemir2012

    Joined:
    Dec 21, 2013
    Posts:
    50
    We are using Addressables in our project and sometimes we can't take build for android platform.

    The problem only occurs when takes android build(Not addressable build) with using Split Application Binary and Build App Bundle (Google Play) options. If I take a build with unchecked Build App Bundle (Google Play) , then build completes successfully and I can run the apk on any real android device. But if I take a build with Build App Bundle (Google Play) , the final aab is generating and I see a popup in Unity about the size of output aab, If I click the "Compute sizes" button then I see duplicated asset entries error on console. After all, if I try to upload the output aab to google play console then I see same error on google play console after upload completed and the upload fails.

    Knowns:
    • If I delete the Library folder the problem is fixed for one time build. But when I delete this folder, it takes ages because the whole project is re-imported... This solution is working for one time; if I try to take a second build after first build it's fails with same error.
    • I am already tried to take new addressable build, this had no effect.
    • I've been having this problem for the past 1 year at Unity 2020.3.1, 2021.3.2 and 2021.3.20.
    • The problem is completely different from this fixed issue.
    • In stacktrace, seems like problem occurs because of a specific bundle, but it's not. If I remove the bundle that mentioned in stacktrace from the project, then an another bundle gives same error on next build.

    Current Unity Version: 2021.3.20
    Current Addressables Version: 1.19.19
    Stacktrace:

    UnityException: Checking APKs size failed
    [BT:1.6.0] Error: Both modules 'base' and 'UnityDataAssetPack' contain asset entry 'assets/aa/Android/defaultlocalgroup_assets_assets/_game/sounds/vehiclesounds/realisticenginesound/assets/sounds/sounds_exotic/v12_aztamartini/low_off.wav_0e5305263431b7be6bc3d17f484cafb5.bundle'.
    com.android.tools.build.bundletool.model.exceptions.InvalidBundleException: Both modules 'base' and 'UnityDataAssetPack' contain asset entry 'assets/aa/Android/defaultlocalgroup_assets_assets/_game/sounds/vehiclesounds/realisticenginesound/assets/sounds/sounds_exotic/v12_aztamartini/low_off.wav_0e5305263431b7be6bc3d17f484cafb5.bundle'.
    at com.android.tools.build.bundletool.model.exceptions.UserExceptionBuilder.build(UserExceptionBuilder.java:58)
    at com.android.tools.build.bundletool.validation.EntryClashValidator.checkEntryClash(EntryClashValidator.java:85)
    at com.android.tools.build.bundletool.validation.EntryClashValidator.lambda$checkEntryClashes$0(EntryClashValidator.java:64)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at com.google.common.collect.CollectSpliterators$1WithCharacteristics.lambda$forEachRemaining$1(CollectSpliterators.java:67)
    at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
    at com.google.common.collect.CollectSpliterators$1WithCharacteristics.forEachRemaining(CollectSpliterators.java:67)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at com.android.tools.build.bundletool.validation.EntryClashValidator.checkEntryClashes(EntryClashValidator.java:60)
    at com.android.tools.build.bundletool.validation.EntryClashValidator.validateAllModules(EntryClashValidator.java:51)
    at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleModulesUsingSubValidator(ValidatorRunner.java:75)
    at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleUsingSubValidator(ValidatorRunner.java:69)
    at com.android.tools.build.bundletool.validation.ValidatorRunner.lambda$validateBundle$3(ValidatorRunner.java:58)
    at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
    at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundle(ValidatorRunner.java:58)
    at com.android.tools.build.bundletool.validation.AppBundleValidator.validate(AppBundleValidator.java:106)
    at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:678)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:76)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:48)

     
    Last edited: Mar 20, 2023
  2. yusufdemir2012

    yusufdemir2012

    Joined:
    Dec 21, 2013
    Posts:
    50
    Is anyone looking here?
     
  3. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi @yusufdemir2012 does the issue still occur in the latest Addressables (1.21.9)? If so, can you submit a bug report? The bundles folder shouldn't be getting included in the "base" asset pack.
     
  4. Bhatti0x

    Bhatti0x

    Joined:
    Jan 27, 2022
    Posts:
    7
    i'm using Addressables (1.21.17) and still facing the same issue
     
  5. OverGast

    OverGast

    Joined:
    Aug 8, 2015
    Posts:
    30
    Is this fixed? Is this issue being taken care of? Still happening.
    Unable to build AAB when using split application binary and local addressables because of the same exact issue.

    Any work-around?
     
  6. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hey, has anyone submitted a bug report for this issue? I don't think we've seen one come in yet.

    Also, just as a point of interest, we've actually got a dedicated Android + Addressables package that's been released. It's called com.unity.addressables.android and it should be visible on Unity 2023.2+ in Package Manager.

    Since that's such a new version of the Editor, we can see if there's a quick fix we might could add for the project. However, the new android package is going to have much fully fledged support going forward.
     
  7. OverGast

    OverGast

    Joined:
    Aug 8, 2015
    Posts:
    30
    Hey! Nice to hear that. Using that package should improve addressables + android right?
    One last thing, in that case, in order to build for iOS I guess I can't use that one, should I stick with regular addressables for iOS and use this new package for android building?
     
  8. OverGast

    OverGast

    Joined:
    Aug 8, 2015
    Posts:
    30
    For future references and for anyone who might come across this issue.
    I found a workaround without using the specific package for Android.

    Issue comes when you build addressables for APK. If then, you swap the build to AAB with split application binary, clear the addressables cache and rebuild the addressables, this issue will popup making you delete all libraries and reimport, as if clearing the cache wasn't enought and something got referenced or stuck somewhere in the folders.

    So we just stopped creating APK for tests and just use AAB's, so far the issue is gone after stop swapping different builds for android.

    Hope this helps someone^^
     
  9. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hey! So, yes, the new android + Addressables package should dramatically improve support for that workflow. At the moment, there's no iOS equivalent in development, so I would stick with regular Addressables there.