Error: cmd.exe failed with args Unreal Engine

Error: cmd.exe failed with args Unreal Engine
Error: cmd.exe failed with args /c rungradle.bat app:assembledebug in ue while packaging to android or windows or oculus or etc . when trying to package project to astc in unreal engine i got build failure and see error cmd.exe failed with args and rungradle.bat .

Solutions to fix error cmd.exe failed with args

to fix error cmd.exe failed with args you must make sure all settings is setup correctly so make sure do these steps :

1 - Install Java Jdk 1.8.0_77 and set JAVA_HOME environment variable .

in article How to Install Java JDK 1.8.0_77 the way to install java jdk 1.8.0_77 and set JAVA_HOME environment variable and check java version .

2 - Install SDK and Fix SDK Problems .

in article How to Install SDK there is steps to install sdk and fix sdk problems .

3 - NDK and Setup Android

in article Unreal Engine Packaging For Android to Any Unreal Engine Version you will find NDK and Setup Android to package game in any unreal engine version .