Search Issue Tracker

Fixed in 2020.3.X

Fixed in 2019.4.X

Votes

5

Found in

2019.4

2020.3

2020.3.15f2

2021.1

Issue ID

1360010

Regression

No

[Android]Build fails when using ARCore XR Plugin and Build App Bundle (Google Play) is selected

ARFoundation

-

Reproduction steps:
1. Load the users attached project "Prj_ARCoreXR_Builds.zip"
2. Open Build Settings
3. Check Build App Bundle (Google Play)
4. Click Build and Run
5. Observe the Console view

Expected Result: Project is successfully built
Actual Result: Errors appear:
------
Installation failed with the following output:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[BT:1.6.0] Error: Both modules 'base' and 'UnityDataAssetPack' contain asset entry 'assets/bin/Data/UnitySubsystems/UnityARCore/UnitySubsystemsManifest.json'.
com.android.tools.build.bundletool.model.exceptions.InvalidBundleException: Both modules 'base' and 'UnityDataAssetPack' contain asset entry 'assets/bin/Data/UnitySubsystems/UnityARCore/UnitySubsystemsManifest.json'.
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)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
-----

Reproducible with: 2019.4.30f1, 2020.3.18f1, 2021.1.21f1

  1. Resolution Note (fix version 2020.3):

    Fixed in 2020.3.24f1

Comments (3)

  1. VoldemortEatsBurgers

    Feb 18, 2022 06:59

    Guys, for this or almost similar cases (in which problem with the different file direction) I advice you just to delete Library folder from Unity project, then start your project from Unity hub. Unity will rewrite its Library without any problems, and this problem will go away. It helped me to solve this. I always do the Library rewrite in such weird cases. Hope my advice will help other people! :) But remember, if your project is quite large (>40Gb), then it can take really a lot of time. Rewrite of Library takes 1-1.5 hours (but obviously it also depends from your`s PC capacity), switching adain to Android takes 1 hour, first build after that can be up to 1-2 hours.

  2. HardK

    Nov 03, 2021 19:34

    You can still build it exclusively on Unity by using this workaround reported by AlkisFortuneFish here: https://forum.unity.com/threads/fail-to-build-app-bundle-aab-file-with-arcore.1175444/

    Just add this script to the Editor folder and you're set :) it checks if it's an AR project and if you have the App Bundle flag.

    Cheers

    #if UNITY_ANDROID && USING_ARFOUNDATION

    using System.IO;
    using UnityEditor;
    using UnityEditor.Android;

    public class AndroidAppBundlePostProcessBuild : IPostGenerateGradleAndroidProject
    {
    public int callbackOrder { get { return 0; } }

    void IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject(string path)
    {
    if (EditorUserBuildSettings.buildAppBundle)
    {
    Directory.Delete(Path.Combine(path, @"../UnityDataAssetPack/src/main/assets/bin/Data/UnitySubsystems"), true);
    }
    }
    }

    #endif

  3. mahoneydev

    Sep 20, 2021 10:03

    Hey to all having this issue!

    I've found a way around the error by using the project export as opposed to fully building through Unity.

    If you select the "Export Project" option in the build settings (while still maintaining the split + .aab setup), the asset bundles are created and you can then access them in Android Studio. Once we open the project we can delete the offending artifact inside the "UnityDataAssetPack" directory before building into the .aab.

    In my testing, a regular project doesn't encounter this duplication, it seems to be surrounding the ARCore and the way Unity is handling the subsystems.

    I hope this helps determine the cause and a possible "Unity only" solution :)

    Cheers,

    Tom

Add comment

Log in to post comment