Batchmode not generating Android Symbols on clean build in Unity 6

I’m automating builds for Unity 6 but are having issues with our android build.

I’ve set up a build profile for Android that specifies that it should generate symbol files and bundle them with the aab + as a separate zip.

But when I run our build script on a clean checkout, (No library folder) the build output does not include the symbols!

If I run the exact same script again, when the Library folder exists, I do get the symbols bundled with the aab and as a zip.

Any idea what could cause this?

My initial guess is that the build profile is not selected and it builds with the default profile which does not have those settings

It does respect the other settings in the build profile though, such as building as aab file.

And it works fine on the second build when Library folder is present (possibly with the symbols from the first build though? Hard to know)

I’m trying to repro this issue but haven’t had any luck so far. Could you share a bit more info?

  • Unity version
  • Your build script
  • CLI arguments you’re using

I’ve tried a few setups, but seems to work on my end. Let me know, and I’ll dig in further. Thanks!

1 Like

Thank you for looking into this!

My unity version is 6000.0.26f1
Computer: Mac mini M4 Pro, 48GB
OS: Sequoia 15.1

Same problem on my Macbook M2 Max running Sonoma 14.2.1

I’m using a slightly modified script from game-ci, I’ll attach it, together with my build profile, and the shell script I use to build.

First build → no symbol files.
Comment out deletion of Library and run again → symbol files included in .aab and as .zip

AndroidBuildIssue.zip (5.3 KB)

Some more hints. I see this in the build output of the first build:

Starting: /Applications/Unity/Hub/Editor/6000.0.26f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/6000.0.26f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-8.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease" 
WorkingDir: /Users/builder/Documents/autobuilder/TGX-main/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher
Android PostProcess task "Building Gradle project" took 180495.0223 ms
DisplayProgressbar: Building Gradle Symbols
Android PostProcess task "Building Gradle Symbols" took 0.2914 ms
DisplayProgressbar: Processing Mapping File
Android PostProcess task "Processing Mapping File" took 0.3098 ms
DisplayProgressbar: Moving output package(s)
Copy '/Users/builder/Documents/autobuilder/TGX-main/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/outputs/bundle/release/launcher-release.aab' -> 
 '/Users/builder/Documents/autobuilder/TGX-main/../Builds/Android/TGX-main/2024-11-26_11-02.aab'
Android PostProcess task "Moving output package(s)" took 355.1608 ms
DisplayProgressbar: Checking APKs size
Cancelling DisplayDialog: App Bundle size warning Your release App Bundle is bigger than 150 MB.
Do you want to compute the min and max download sizes of APKs generated from your App Bundle?

You can turn off this warning or adjust threshold value in Android Player Settings.
This should not be called in batch mode.
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEditor.EditorUtility:DisplayDialogImpl (string,string,string,string)
UnityEditor.EditorUtility:DisplayDialog (string,string,string,string) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorUtility.bindings.cs:51)
UnityEditor.Android.PostProcessor.Tasks.CheckApksSize:Execute (UnityEditor.Android.PostProcessor.PostProcessorContext)
UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext)
UnityEditor.Android.PostProcessAndroidPlayer:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput)
UnityEditor.Android.AndroidBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTarget,int,string,string,string,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:285)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[],bool)
UnityEditor.BuildPipeline:BuildPlayerInternal (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:513)
UnityEditor.BuildPipeline:BuildPlayer (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:397)
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:361)
BuildCommand:PerformBuild () (at Assets/Editor/BuildCommand.cs:183)

[/Users/bokken/build/output/unity/unity/Editor/Mono/EditorUtility.bindings.cs line 51]

Android PostProcess task "Checking APKs size" took 35.999 ms
Android PostProcess task "Checking Symbols size" took 0.3724 ms

On the second build I instead get this:

Starting: /Applications/Unity/Hub/Editor/6000.0.26f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/6000.0.26f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-8.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease" 
WorkingDir: /Users/builder/Documents/autobuilder/TGX-main/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher
Android PostProcess task "Building Gradle project" took 96112.9134 ms
DisplayProgressbar: Building Gradle Symbols
[Licensing::Client] Successfully resolved entitlement details
Starting: /Applications/Unity/Hub/Editor/6000.0.26f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/6000.0.26f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-8.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "mergeReleaseNativeDebugMetadataSo" 
WorkingDir: /Users/builder/Documents/autobuilder/TGX-main/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher
Android PostProcess task "Building Gradle Symbols" took 38153.1155 ms
DisplayProgressbar: Processing Mapping File
Android PostProcess task "Processing Mapping File" took 0.5272 ms
DisplayProgressbar: Moving output package(s)
Copy '/Users/builder/Documents/autobuilder/TGX-main/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/outputs/bundle/release/launcher-release.aab' -> 
 '/Users/builder/Documents/autobuilder/TGX-main/../Builds/Android/TGX-main/2024-11-26_13-20.aab'
Copy '/Users/builder/Documents/autobuilder/TGX-main/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/outputs/native-debug-symbols/release/native-debug-symbols-so.zip' -> 
 '/Users/builder/Documents/autobuilder/TGX-main/../Builds/Android/TGX-main/2024-11-26_13-20-0.1.24-v30-IL2CPP.symbols.zip'
Android PostProcess task "Moving output package(s)" took 553.9959 ms
DisplayProgressbar: Checking APKs size
Cancelling DisplayDialog: App Bundle size warning Your release App Bundle is bigger than 150 MB.
Do you want to compute the min and max download sizes of APKs generated from your App Bundle?

You can turn off this warning or adjust threshold value in Android Player Settings.
This should not be called in batch mode.
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEditor.EditorUtility:DisplayDialogImpl (string,string,string,string)
UnityEditor.EditorUtility:DisplayDialog (string,string,string,string) (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorUtility.bindings.cs:51)
UnityEditor.Android.PostProcessor.Tasks.CheckApksSize:Execute (UnityEditor.Android.PostProcessor.PostProcessorContext)
UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext)
UnityEditor.Android.PostProcessAndroidPlayer:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput)
UnityEditor.Android.AndroidBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTarget,int,string,string,string,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:285)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[],bool)
UnityEditor.BuildPipeline:BuildPlayerInternal (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:513)
UnityEditor.BuildPipeline:BuildPlayer (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:397)
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:361)
BuildCommand:PerformBuild () (at Assets/Editor/BuildCommand.cs:183)

[/Users/bokken/build/output/unity/unity/Editor/Mono/EditorUtility.bindings.cs line 51]

Android PostProcess task "Checking APKs size" took 41.1042 ms
DisplayProgressbar: Checking Symbols size
Checking symbols size:
    Symbols package '/Users/builder/Documents/autobuilder/TGX-main/../Builds/Android/TGX-main/2024-11-26_13-20-0.1.24-v30-IL2CPP.symbols.zip' total size (540MB) is below threshold 800MB, all good.
    Symbols ('BUNDLE-METADATA/com.android.tools.build.debugsymbols') in '/Users/builder/Documents/autobuilder/TGX-main/../Builds/Android/TGX-main/2024-11-26_13-20.aab' total compressed size (540MB) is below threshold 800MB, all good.
Android PostProcess task "Checking Symbols size" took 49.737 ms

Could the mising part about “Sucessfully resolved entitlement details” be a hint?
It seems “Building Gradle Symbols” never starts “mergeReleaseNativeDebugMetadataSo” for some reason.

On a separate note, the apk size warning is present in both logs, but it does say “This should not be called in batch mode.”. I have no idea how to turn that off for batch mode though?

@IL_Olof Thanks for providing the info! I was able to reproduce the issue using the setup you shared. Looks like there is an issue where -activeBuildProfile is causing problems when rebuilding the library folder. In the meantime, if this issue is blocking your progress, here are two temporary solutions that might help:

  1. Using AssetDatabase.LoadAssetAtPath<BuildProfile> I used this to attempt reproducing the issue, but it works correctly on 6000.1.0a6. Builds the AAB with symbols, when starting from a clean checkout (Library folder deleted).
  2. Downgrading Unity: The problem appears to start with version 6000.0.20f1. Downgrading to 6000.0.19f1 resolves the issue.

Solution 1 example:
Run the following command + script:

Unity -batchmode -projectPath <p_path> -executeMethod BuildTest.Build -quit
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Profile;
using UnityEngine;

public static class BuildTest
{
    public static void Build()
    {
        var buildProfile = AssetDatabase.LoadAssetAtPath<BuildProfile>("Assets/Settings/Build Profiles/ProfileTest.asset");

        var options = new BuildPlayerWithProfileOptions
        {
            buildProfile = buildProfile,
            locationPathName = "Builds/MyGame.aab"
        };

        BuildPipeline.BuildPlayer(options);
    }
}

I’ve shared this with the team, and we’ll work on implementing a permanent fix.

Thank you for the assistance!

I tried to add a -customBuildProfile argument so I could use BuildPlayerWithProfileOptions in my build script.

Unfortunately this gives me another problem, the build fails with

DisplayProgressbar: Checking prerequisites
Uploading Crash Report
UnityException: Can not sign the application
Unable to sign the application; please provide passwords!
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck_Injected(String[], ManagedSpanWrapper&, ManagedSpanWrapper&, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:513)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:397)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:361)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerWithProfileOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:332)
BuildCommand:PerformBuild() (at Assets/Editor/BuildCommand.cs:189)

(Filename: Assets/Editor/BuildCommand.cs Line: 189)

My guess is it is related to me using a custom keystore to sign the aab. I tried to also include the Player Options (which includes the settings for the custom keystore( in the Build Profile, but this did not help… (Using the “customize player settings” button in the build profiles setting in the editor)

Attaching my modified scripts…

AndroidBuildIssue2.zip (4.1 KB)

I’ve not tried downgrading yet, but I hope that will not be needed since we’re already in production with .26f1, and using non-LTS versions is also not an option. I can still do builds with 26f1, just have to build twice…

There is another issue with .26f though I havn’t mentioned yet since the missing symbols on the first build are more importent, when building android in batchmode with my script with the Library present, it will hang and never return from BuildPipeline.BuildPlayer. It has though already produced the .aab file and symbols at the point it hangs, just my script will never finish. Annoying and stops full automation, but at least I get a working artifact.

Another update…

If I manually set

PlayerSettings.Android.useCustomKeystore
PlayerSettings.Android.keystoreName
PlayerSettings.Android.keystorePass
PlayerSettings.Android.keyaliasPass

in my build script, it does manage to sign, but it produces an .apk instead of an aab…

So it seems like not all my profile and player settings are included in the “clean” build in .26f1, even when using AssetDatabase.LoadAssetAtPath<BuildProfile>(…)

Hi,

It seems there are multiple issues. I would like to kindly ask you to report each issue via the bug reporter and make sure to attach the Unity Project where this issue is encountered.

Please follow these steps:

  1. Open the Bug Reporter from the project (Help → Report a Bug…).
  2. Provide a detailed description of the steps required to reproduce the bug so it can be observed clearly.
  3. Include a link to this discussion thread in the description.

This process will help us understand the issue better, identify its source, and track each problem to ensure they are all resolved. Thank you!

Hi Maxime,

Thank you for your assistance.

Since this is a rather large proprietary game project I can’t possibly share it, but I’ll try to find some time to see if I can reproduce it in a minimal project.

Sounds good, thank you!

I’m currently setting up a testing project to try a few things. For the first issue, could you try removing all the ifdefs to see if that resolves the problem?

BuildCommand.cs|attachment (9.0 KB)

I tried using your attached script without #ifdefs, and unfortunately it still did not generate the symbol files.