ERROR: Exception in UnrealBuildTool: ERROR: cmd.exe failed with args

Hi,

i got a build error for android its an project with nothing custom inside

LogPlayLevel: BuildCommand.Execute: ERROR: BUILD FAILED
LogPlayLevel: Program.Main: ERROR: AutomationTool terminated with exception:
LogPlayLevel: Program.Main: ERROR: Exception in UnrealBuildTool: ERROR: cmd.exe failed with args /c “C:/MyNVPACK/apache-ant-1.8.2/bin/ant.bat” -quiet debug
LogPlayLevel: Stacktrace: bij UnrealBuildTool.Android.UEDeployAndroid.RunCommandLineProgramAndThrowOnError(String WorkingDirectory, String Command, String Params, String OverrideDesc, Boolean bUseShellExecute)
LogPlayLevel: bij UnrealBuildTool.Android.UEDeployAndroid.MakeApk(String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk)
LogPlayLevel: bij UnrealBuildTool.Android.UEDeployAndroid.PrepForUATPackageOrDeploy(String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bIsDataDeploy)
LogPlayLevel: bij AndroidPlatform.Deploy(ProjectParams Params, DeploymentContext SC)
LogPlayLevel: bij Project.Deploy(ProjectParams Params)
LogPlayLevel: bij BuildCookRun.DoBuildCookRun(ProjectParams Params)
LogPlayLevel: bij BuildCommand.Execute()
LogPlayLevel: bij AutomationTool.Automation.Execute(List1 CommandsToExecute, CaselessDictionary1 Commands)
LogPlayLevel: bij AutomationTool.Automation.Process(String[] CommandLine)
LogPlayLevel: bij AutomationTool.Program.MainProc(Object Param)
LogPlayLevel: bij AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param)
LogPlayLevel: bij AutomationTool.Program.Main()
LogPlayLevel: Program.Main: ERROR: ERROR: cmd.exe failed with args /c “C:/MyNVPACK/apache-ant-1.8.2/bin/ant.bat” -quiet debug
LogPlayLevel: ProcessManager.KillAll: Trying to kill 0 spawned processes.
LogPlayLevel: Program.Main: AutomationTool exiting with ExitCode=1
LogPlayLevel: Domain_ProcessExit
LogPlayLevel: ProcessManager.KillAll: Trying to kill 0 spawned processes.
LogPlayLevel: copying UAT log files…
LogPlayLevel: RunUAT.bat ERROR: AutomationTool was unable to run successfully.
LogPlayLevel: Completed Launch On Stage: Deploy Task, Time: 42.280850
LogPlayLevel: BUILD FAILED

  1. Please ensure you have TADP set up, along with your Android SDK in project settings and your environment variables. Restart your computer.

  2. Make sure there is nothing unusual (additional spaces for example about your Android package name or TADP setup.

  3. Make sure keystore is set up correctly, if you’re packaging for distribution and receiving this error. Here is some additional keystore instruction.

  4. Double check for proguard errors.

  5. Last resort, delete current build of TADP and upgrade to most recent. Make sure to have SDK 19 and NDK checked when installing.

Good luck.

i tried everything that you mentioned in your Answer but still getting this Error

ERROR: cmd.exe failed with args /c “C:\Users\Is\Documents\Unreal Projects\test\Intermediate/Android/APK\gradle\rungradle.bat” :app:assembleDebug

You need to install the lower version of gradle which is present in android studio 3.5.3
and use the android studio 3.5.3 Jre folder for jdk location in unreal engine also change the environment variables for jdk to jre in java_home variable.
Good luck