Batchmode Builds Failing After Update to Unity 2022.3 (APK Still Created)

I’ve recently updated my project from Unity 2020 to Unity 2022.3. Since the update, I’ve been encountering issues with builds. This problem seems to be related to a timeout, but I don’t believe that’s the actual root cause.

Details:

  • Environment: Local windows & Jenkins CI, Unity 2022.3
  • Pipeline & Build Code: No changes from the previous working version.
  • Issue on Jenkins: The error suggests a timeout, but the APK is built correctly.

Here’s the error I encounter in Jenkins:

[exec] Aborting batchmode due to failure:
[exec] Timeout after 300 seconds while waiting async operations to finish. executeMethod 'Framework.BuildAutomation.Build.PerformAndroidBuild'
[exec]

The 300-second timeout doesn’t seem to be the actual issue, as removing the -quit flag allows the build to continue indefinitely (even beyond an hour) without breaking the pipeline.

However, when I try using EditorApplication.Exit(0); instead of the -quit flag, Jenkins throws a different error:

/Users/jenkins/.jenkins/Ant/build.xml:255: Unity3D failed to create a build. Please take a look at the log for details.

Interestingly, the APK is also generated in this case.

What I’ve Tried:

  • Removing the -quit flag: This prevents the timeout but causes Jenkins to hang indefinitely.
  • Using EditorApplication.Exit(0);: This leads to another error related to the Ant build script, despite the APK being built successfully.

I’ve come across a similar issue discussed here: Unity Forum Discussion, but it didn’t provide a working solution for my case.

Has anyone else faced similar issues after updating to Unity 2022.3 in a Jenkins environment? Any help or suggestions would be greatly appreciated!

Thanks in advance!

Update: build doesn’t work in batchmode windows as well, so it is no CI / jenkins settings. Locally from cmd it ends up in same way

1 Like

Fail reason wasn’t actually connected to timeout log, there was another one much higher in build logs.

I just had the exact same issue:

  • batch mode simply never exiting, despite the build completing successfully.

This is on a machine that never had these issues before, it just randomly happened and broke my build pipeline. In my case, I solved it by adding EditorApplication.Exit(0); to the end of the build script.

Unity version: 2022.3.51f1