Android build fails (UnrealBuildTool)

Android build started failing suddenly, even older versions won’t build anymore which worked fine.

UnrealBuildTool Exception: System.FormatException: Input string was not in a correct format.

at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal).

at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info).

at UnrealBuildTool.AndroidToolChain.GetLargestApiLevel(String[] ApiLevels).

at UnrealBuildTool.Android.UEDeployAndroid.GetSdkApiLevel().

at UnrealBuildTool.Android.UEDeployAndroid.MakeAPK(String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution).

at UnrealBuildTool.Android.UEDeployAndroid.PrepForUATPackageOrDeploy(String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution).

at UnrealBuildTool.Android.UEDeployAndroid.PrepTargetForDeployment(UEBuildTarget InTarget).

at UnrealBuildTool.UnrealBuildTool.Main(String[] Arguments).

BuildCommand.Execute: ERROR: BUILD FAILED.

Program.Main: ERROR: AutomationTool terminated with exception:.

Program.Main: ERROR: Exception in AutomationTool: Command failed (Result:2): P:\Unreal Engine\4.2\Engine\Binaries\DotNET\UnrealBuildTool.exe Summer2014 Android Development “W:\Unreal Projects\Summer2014\Summer2014.uproject” -noxge -rocket. See logfile for details: ‘UnrealBuildTool.txt’ .

Stacktrace: at AutomationTool.CommandUtils.RunAndLog(String App, String CommandLine, String Logfile, Int32 MaxSuccessCode, String Input, ERunOptions Options).

at AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, String CommandLine, String LogName).

at AutomationTool.UE4Build.BuildWithUBT(String ProjectName, String TargetName, UnrealTargetPlatform TargetPlatform, String Config, String UprojectPath, Boolean ForceMonolithic, Boolean ForceNonUnity, Boolean ForceDebugInfo, Boolean ForceFlushMac, Boolean DisableXGE, String InAddArgs, Boolean ForceUnity).

at AutomationTool.UE4Build.Build(BuildAgenda Agenda, Nullable`1 InDeleteBuildProducts, Boolean InUpdateVersionFiles, Boolean InForceNoXGE, Boolean InForceNonUnity, Boolean InForceUnity).

at Project.Build(BuildCommand Command, ProjectParams Params, Int32 WorkingCL).

at BuildCookRun.DoBuildCookRun(ProjectParams Params).

at BuildCommand.Execute().

at AutomationTool.Automation.Execute(List1 CommandsToExecute, CaselessDictionary1 Commands).

at AutomationTool.Automation.Process(String[] CommandLine).

at AutomationTool.Program.MainProc(Object Param).

at AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param).

at AutomationTool.Program.Main().

Program.Main: ERROR: Command failed (Result:2): P:\Unreal Engine\4.2\Engine\Binaries\DotNET\UnrealBuildTool.exe Summer2014 Android Development “W:\Unreal Projects\Summer2014\Summer2014.uproject” -noxge -rocket. See logfile for details: ‘UnrealBuildTool.txt’ .

Program.Main: AutomationTool exiting with ExitCode=1

Found what was wrong: I had installed android sdk api level 20 which caused problems since ndk is only up to 19 or something.

Manifest and makefiles asked for api 18 but seems like it still tried to pick latest api.

Hey Zeitt,
I have run into the same build issue. I don’t understand how you fixed it. Could you elaborate more or point me in the right direction?

I just uninstalled everything related to “android l” (Android L & Android 4.4W) in sdk manager but kept updated version of Android sdk-tools (23.0.1) and everything started to work again

Thank you Zeitt! That worked for me as well.

Hi Zeitt, there is a lot of Manifest files, which one I need to config it to right API?
I have same problem with you, but seems I have to remove all API except API 9, then UE4 can build success.

instead of uninsatlling newer api,is there anyway to choose which android api unreal should use?