Did 5.3 break Android batch mode?

We’re running automated builds using on a Mac using

“/Applications/Unity XXXX/Unity.app/Contents/MacOS/Unity” -projectPath /the/path -logFile /the/path/unity3d_editor.log -quit -batchmode -executeMethod XXXX.PerformAndroidBuild

This works on most projects except with a new job configured to run with 5.3.4f1. That job keeps failing with the following errors:

I’ve tried quite a few things:

  • Force the Android SDK location using:

/usr/libexec/PlistBuddy -c “Add :AndroidSdkRoot string ‘/Applications/android-sdk-macosx’” ~/Library/Preferences/com.unity3d.UnityEditor5.x.plist

(before or during the build!)

Yet at some point during the build, the setting is lost.

( Note that the user isn’t logged in on the account and IL2CPP isn’t enabled )

I noticed the following in the 5.3.4f1 release notes

  • Android: Buildpipe - don’t open file dialogs when in batch mode
  • Android: Buildpipe - Fixed an issue where projects created on Mac wouldn’t build on Windows
  • Android: Buildpipe - Fixed an issue where the Editor would hang if in batch mode without SDK, NDK and JDK properly configured

but nothing related in the 5.3.4 patch releases.

The fact that the editor log contains “This should not be called in batch mode.” is a bit strange. I couldn’t find other reference to that phrase on the web.

Bug ?

In the meantime I’ll troubleshoot further.

I struggled a bit more:

on a different computer, with Unity 5.3.4f1 freshly installed.

  • at start, the Unity 5 preferences (~/Library/Preferences/com.unity3d.UnityEditor5.x.plist) is rather empty
  • build from the CLI => build fails
  • build from the GUI after filling the preferences => build passes
  • build from the CLI again => build passes

back to the build server

  • build from CLI => build fails
  • build from the GUI after filling the preferences => build passes
  • build from the CLI again => build fails

note that the preferences are basically reset (at Editor startup it seems)

$ /usr/libexec/PlistBuddy -c "Print" ~/Library/Preferences/com.unity3d.UnityEditor5.x.plist 
Dict {
    GICacheMaximumSizeGB = 10
    RecentlyUsedProjectPaths-3 = /Users/Shared/Jenkins/Home/jobs/game_treasure-master_iOS/workspace
    GA_COOKIE = c1cd506a3675149xxxxxxxxxxxxxxxx
    GICacheCompressionLevel = 1
    RecentlyUsedProjectPaths-7 = /Users/Shared/Unity/4-0_AngryBots
    Editor.kEditorLocale = en
    RecentlyUsedProjectPaths-6 = /Users/Shared/Jenkins/Home/jobs/game_addtetris-master_iOS/workspace
    kWorkspacePath = /Users/Shared/Jenkins/Home/jobs/proto_QuizWWTK_android
    RecentlyUsedProjectPaths-2 = /Users/Shared/Jenkins/Home/jobs/proto_QuizWWTK_iOS/workspace
    kAutoRefresh = 1
    LSValue = -1411324300
    RecentlyUsedProjectPaths-5 = /Users/Shared/Jenkins/Home/jobs/game_DragonBoxPlus-master_webgl/workspace
    RecentlyUsedProjectPaths-1 = /Users/Shared/Jenkins/Home/jobs/game_addtetris-master_u5_iOS/workspace
    LastOpenedScene = Assets/AngryBots.unity
    kProjectBasePath = /Users/Shared/Jenkins/Home/jobs/proto_QuizWWTK_android/workspace
    SpritePackerCacheMaximumSizeGB = 10
    RecentlyUsedProjectPaths-4 = /Users/Shared/Jenkins/Home/jobs/game_DragonBoxPlus-1.x_webgl/workspace
    RecentlyUsedProjectPaths-0 = /Users/Shared/Jenkins/Home/jobs/proto_QuizWWTK_android/workspace
}

We worked around this by injecting the AndroidSdkPath in the EditorPrefs at build time. Not really sure what caused it.

1 Like

I get the same problem at Unity 2017 1.0f3.
Build In editor is work fine.
But Shell script always failed
How did you solve this question finily?