[2021.2.6] Unity dont quit in batchmode after android build
I start unity [2021.2.6f1] android build in jenkins command line with arguments:
%UNITY_DIR% -quit -batchmode -nographics -projectPath %PROJECT_PATH% -executeMethod %EXECUTION_METHOD% -buildTarget android -logFile -
After build finishing unity keep endless hanging with logs:
AcceleratorClientConnectionCallback - disconnected - :0.
Cleanup mono
While hanging I noticed "OpenJDK platform binary" process in WIndows task manager. After killing process from task manager Unity finally quits with logs
debugger-agent: Unable to listen on 3900
[usbmuxd] Stop listen thread
[usbmuxd] Listen thread exiting
Exiting batchmode successfully now!
Exiting without the bug reporter. Application will terminate with return code 0
Maybe someone now how to fix that hanging on "cleanup mono"? WIth Unity 2021.1.* everything works ok, the problem is only with 2021.2
Answer by bleater · Feb 03 at 05:16 AM
I'm also running into this issue, similar Unity version (2019.2.21f1). In my case, I call Unity in a series of steps to do builds for different platforms. Since we changed to the IL2CPP backend, we intermittently get this stall during the "Cleanup mono" step.
Interestingly, as noted in this issue (closed by Unity QA as "Not Reproducible") https://issuetracker.unity3d.com/issues/editor-freezes-on-cleanup-mono-after-building-the-player-when-exiting-after-batchmode-build, at least one user noted that it only occurred on the second invocation of the editor in batchmode. One user reported leaving a 30 second delay between editor invocations worked around the problem. Worth a shot.
Your answer
![](https://koobas.hobune.stream/wayback/20220613050607im_/https://answers.unity.com/themes/thub/images/avi.jpg)