Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Unity batch mode process freezes for Android builds

Discussion in 'Editor & General Support' started by ohthepain, Apr 1, 2021.

  1. ohthepain

    ohthepain

    Joined:
    May 31, 2017
    Posts:
    100
    We moved to 2020.3.2f1 and are trying to fix our Intel Mac mini build machine.

    iOS builds and is playable; however, the android build just freezes ever since updating Unity.

    I can open the project in the editor and build and run on the build machine.

    Occasionally I connect to the build machine and see a system dialog ‘Unity Hub wants to make changes’. It’s not supposed to be showing dialogs in batchmode.

    Here is the command line I am using to test:

    /Applications/Unity/Hub/Editor/2020.3.2f1/Unity.app/Contents/MacOS/Unity -projectPath /Users/teamviewer/builds/AbxzEpLH/0/thisco/myprojectname -executeMethod BuildCommand.BuildAndroidDevelopmentRemote -buildTarget Android -batchmode

    I can confirm that 2020.3.2f1 is the correct version of unity.

    There is no error message.

    Here is a tail of the log:
    Code (CSharp):
    1. Unloading 2969 unused Assets to reduce memory usage. Loaded Objects now: 23260.
    2. Total: 1760.862750 ms (FindLiveObjects: 6.199505 ms CreateObjectMapping: 5.160122 ms MarkObjects: 1737.530675 ms  DeleteObjects: 11.969555 ms)
    3. Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
    4. Loaded scene 'Temp/__Backupscenes/0.backup'
    5.     Deserialize:            3.134 ms
    6.     Integration:            221.335 ms
    7.     Integration of assets:  0.006 ms
    8.     Thread Wait Time:       21.093 ms
    9.     Total Operation Time:   245.568 ms
    10. System memory in use before: 0.94 GB.
    11. System memory in use after: 0.94 GB.
    12. Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 23252.
    13. Total: 1443.301999 ms (FindLiveObjects: 5.859550 ms CreateObjectMapping: 3.460020 ms MarkObjects: 1433.910639 ms  DeleteObjects: 0.068975 ms)
    14. [Project] Loading completed in 713.512 seconds
    15.     Project init time:                 0.000 seconds
    16.         Template init time:         0.000 seconds
    17.         Package Manager init time:         0.000 seconds
    18.         Asset Database init time:         0.000 seconds
    19.         Global illumination init time:     0.000 seconds
    20.         Assemblies load time:             0.000 seconds
    21.         Unity extensions init time:     0.000 seconds
    22.         Asset Database refresh time:     0.000 seconds
    23.     Scene opening time:             589.731 seconds
    24. Subscribe to USB device events
    25. [00:00:01] Enlighten: Builtin Sky manager started.
    26. [MODES] ModeService[none].Initialize
    27. [MODES] ModeService[none].LoadModes
    28. [MODES] Loading mode Default (0) for mode-current-id-BadEnergyKids
    29. [00:00:02] Enlighten: Finished 1 Bake Ambient Probe job (0.01s execute, 0.00s integrate, 0.44s wallclock)
    Here is our build command
    Code (CSharp):
    1.     private static void BuildAndroid(bool development, bool localBuild,
    2.         BuildOptions options = BuildOptions.None, AndroidArchitecture deviceTarget = AndroidArchitecture.All, bool isaab = false) {
    3.         string[] scenes = GetBuildScenes();
    4.  
    5.         string path = GetBuildPath("android");
    6.  
    7.         if (scenes == null || scenes.Length == 0 || path == null) {
    8.             return;
    9.         }
    10.  
    11.         ApplyAndroidBuildSettings(development, localBuild, deviceTarget,isaab);
    12.  
    13.         BuildPipeline.BuildPlayer(scenes, path, BuildTarget.Android, options);
    14.     }
    15.    
    16.     public static void BuildAndroidDevelopmentRemote() {
    17.         EditorUserBuildSettings.buildAppBundle = false;
    18.         BuildAndroid(true, false, BuildOptions.None, AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64);
    19.     }
     
  2. GoinPlaces

    GoinPlaces

    Joined:
    Nov 15, 2017
    Posts:
    14
    Same issue here on Mac, any solution?
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,412
    Baking can take a spectacularly long amount of time, hours and hours even. Since the last entry is enlighten, that would be my first investigation. Bake all your lights or simply disable all baked lighting, try to build.

    OTHERWISE...

    How to troubleshoot build failures:

    First, make a blank project with a single blank scene and prove that it builds successfully.

    If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

    Until you can build a blank project to the target platform, don't fiddle with anything else.

    Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

    Most often things that prevent building are third-party libraries such as Firebase.

    Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

    It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

    Android build not building:

    Recently (circa July 2022) there have been reports of Unity's installer failing to install the Android Tools.

    https://forum.unity.com/threads/cant-build-for-android.1306098/

    Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022 (edited on August 23, 2023 to include Android SDK 33...):

    https://forum.unity.com/threads/aab...y-2021-3-8-with-jdk-1-8.1322211/#post-8551193

    Android Gradle errors and other related stuff:

    https://forum.unity.com/threads/unity-gradle-bug-please-help.1368018/#post-8625789