Error during Launch: Could not find or load main class org.apache.tools.ant.launch.Launcher

Branch: Binary

Build version: 4.8.0 - 2579680

Description: I’m on OS X using UE 4.8 and installed Apache ANT via Homebrew.
I’m trying to launch the Strategy Game on my Android device. After the build I get this error:

**Here is the full build-log buildlog.txt **

LogPlayLevel: mono: ====6/11/2015 11:51:52 PM====PERFORMING FINAL APK PACKAGE OPERATION================================================
LogPlayLevel: mono: Making .apk with Ant... (note: it's safe to ignore javac obsolete warnings)
LogPlayLevel: mono: Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
LogPlayLevel: mono: UnrealBuildTool Exception: ERROR: /bin/sh failed with args -c '"/usr/local/Cellar/ant/1.9.4//bin/ant" -quiet debug'
LogPlayLevel: CommandUtils.Run: Run: Took 30.474619s to run mono, ExitCode=5
LogPlayLevel: ErrorReporter.Error: ERROR: AutomationTool error: Command failed (Result:5): /Users/Shared/UnrealEngine/4.8/Engine/Binaries/DotNET/UnrealBuildTool.exe StrategyGame Android Development  "/Users/ali/Documents/Unreal Projects/StrategyGame/StrategyGame.uproject"  -noxge -rocket -nocreatestub -NoHotReloadFromIDE -ignorejunk. See logfile for details: 'UnrealBuildTool.3.txt'
LogPlayLevel: BuildCommand.Execute: ERROR: BUILD FAILED
LogPlayLevel: Program.Main: ERROR: AutomationTool terminated with exception:
LogPlayLevel: Program.Main: ERROR: Exception in AutomationTool: Command failed (Result:5): /Users/Shared/UnrealEngine/4.8/Engine/Binaries/DotNET/UnrealBuildTool.exe StrategyGame Android Development  "/Users/ali/Documents/Unreal Projects/StrategyGame/StrategyGame.uproject"  -noxge -rocket -nocreatestub -NoHotReloadFromIDE -ignorejunk. See logfile for details: 'UnrealBuildTool.3.txt'
LogPlayLevel: Stacktrace:   at AutomationTool.CommandUtils.RunAndLog (System.String App, System.String CommandLine, System.String Logfile, Int32 MaxSuccessCode, System.String Input, ERunOptions Options, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0
LogPlayLevel:   at AutomationTool.CommandUtils.RunAndLog (AutomationTool.CommandEnvironment Env, System.String App, System.String CommandLine, System.String LogName, Int32 MaxSuccessCode, System.String Input, ERunOptions Options, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0
LogPlayLevel:   at AutomationTool.CommandUtils.RunUBT (AutomationTool.CommandEnvironment Env, System.String UBTExecutable, System.String CommandLine, System.String LogName, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0
LogPlayLevel:   at AutomationTool.CommandUtils.RunUBT (AutomationTool.CommandEnvironment Env, System.String UBTExecutable, System.String Project, System.String Target, System.String Platform, System.String Config, System.String AdditionalArgs, System.String LogName, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0
LogPlayLevel:   at AutomationTool.UE4Build.BuildWithUBT (System.String ProjectName, System.String TargetName, UnrealTargetPlatform TargetPlatform, System.String Config, System.String UprojectPath, Boolean ForceMonolithic, Boolean ForceNonUnity, Boolean ForceDebugInfo, Boolean ForceFlushMac, Boolean DisableXGE, System.String InAddArgs, Boolean ForceUnity, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0
LogPlayLevel:   at AutomationTool.UE4Build.Build (AutomationTool.BuildAgenda Agenda, Nullable`1 InDeleteBuildProducts, Boolean InUpdateVersionFiles, Boolean InForceNoXGE, Boolean InForceNonUnity, Boolean InForceUnity, System.Collections.Generic.Dictionary`2 PlatformEnvVars) [0x00000] in <filename unknown>:0
LogPlayLevel:   at Project.Build (BuildCommand Command, AutomationTool.ProjectParams Params, Int32 WorkingCL) [0x00000] in <filename unknown>:0
LogPlayLevel:   at BuildCookRun.DoBuildCookRun (AutomationTool.ProjectParams Params) [0x00000] in <filename unknown>:0
LogPlayLevel:   at BuildCookRun.ExecuteBuild () [0x00000] in <filename unknown>:0
LogPlayLevel:   at BuildCommand.Execute () [0x00000] in <filename unknown>:0
LogPlayLevel: Program.Main: ERROR: Command failed (Result:5): /Users/Shared/UnrealEngine/4.8/Engine/Binaries/DotNET/UnrealBuildTool.exe StrategyGame Android Development  "/Users/ali/Documents/Unreal Projects/StrategyGame/StrategyGame.uproject"  -noxge -rocket -nocreatestub -NoHotReloadFromIDE -ignorejunk. See logfile for details: 'UnrealBuildTool.3.txt'
LogPlayLevel: Program.Main: AutomationTool exiting with ExitCode=5
LogPlayLevel: Domain_ProcessExit
LogPlayLevel: Completed Launch On Stage: Build Task, Time: 36.344695
LogPlayLevel: RunUAT ERROR: AutomationTool was unable to run successfully.
PackagingResults:Error: Error Launch failed! Unknown Error

Hi DJ_Hedgehog,

I see a couple of things. Your NDK is set to 19 and your SDK is set to 21. You should set the SDK to 19 or else you’ll only be able to deploy your project to Android 5.0 devices. That shouldn’t cause your build failure though.

I see this error:

/Users/ali/Documents/Unreal
Projects/StrategyGame/Binaries/Android/StrategyGame-armv7-es2.apk
is out of date due to newer input file
/Users/ali/Documents/Unreal
Projects/StrategyGame/Binaries/Android/StrategyGame-armv7-es2.so

which indicates you may need to compile in Visual Studio for Development and Android before you will be able to package.

Lastly, there’s this: UnrealBuildTool Exception: ERROR: /bin/sh failed with args -c ‘“/usr/local/Cellar/ant/1.9.4//bin/ant” -quiet debug’

That ant.bat error can be many things, including several that are unrelated to the Unreal Editor. You might consider rolling back to the 1.8.2 version of Ant just to be on the safe side. Here is an AnswerHub thread addressing that error and several things you can try to see if it will resolve.

Lastly, since you’re on Mac and Apache Ant involves Java, you might need to install Java 6 from Apple AND Java 7 from Oracle, as per the ultimate answer on this AnswerHub thread.

Here is the Apple link for that.

Good luck!

Hi DJ_Hedgehog,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.