ERROR: cmd.exe failed with args

Hi,
i got a build error for android

UATHelper: Packaging (Android (ATC)): ERROR: cmd.exe failed with args /c “D:\unrealtest\m1\Intermediate/Android/APK\gradle\rungradle.bat” :app:assembleDebug

UATHelper: Packaging (Android (ATC)): (see C:\Users\ABRA\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.21\Log.txt for full exception trace)

UATHelper: Packaging (Android (ATC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)

UATHelper: Packaging (Android (ATC)): BUILD FAILED
PackagingResults: Error: cmd.exe failed with args /c “D:\unrealtest\m1\Intermediate/Android/APK\gradle\rungradle.bat” :app:assembleDebug
PackagingResults: Error: Unknown Error

1 Like

Hi…

Try unchecking the “Enable Gradle instead of Ant” checkbox in Project Settings.

I’m having the same problem. Just updated UE to 4.21 and reinstalled the NVPACK to Codeworks 1R7 as given in the UE Engine Folder…
If you take a look at some lines above, it says (at least for me):

UATHelper: Packaging (Android (ASTC)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (ASTC)): * What went wrong:
UATHelper: Packaging (Android (ASTC)): A problem occurred configuring project ':app'.
UATHelper: Packaging (Android (ASTC)): > You have not accepted the license agreements of the following SDK components:
UATHelper: Packaging (Android (ASTC)):   [Android SDK Build-Tools 26.0.2].
UATHelper: Packaging (Android (ASTC)):   Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
UATHelper: Packaging (Android (ASTC)):   Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
UATHelper: Packaging (Android (ASTC)): * Try:
UATHelper: Packaging (Android (ASTC)): Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
UATHelper: Packaging (Android (ASTC)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (ASTC)): BUILD FAILED in 14s
UATHelper: Packaging (Android (ASTC)): ERROR: cmd.exe failed with args /c "D:\TJProjects\SPF\Special Police Forces 4.20\Intermediate/Android/APK\gradle\rungradle.bat" :app:assembleRelease
UATHelper: Packaging (Android (ASTC)):        (see C:\Users\\Roaming\Unreal Engine\AutomationTool\Logs\D+Programme+Epic+Games+UE_4.21\Log.txt for full exception trace)
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
PackagingResults: Error: Unknown Error

Found a solution:

As enabling ANT instead of gradle gave me the same problem and all licences were already checked, I found an other solution:

  1. Go to NVPACK\android-sdk-windows\tools and run android.bat to execute the SDK-Manager (not the CodeWorks Manager)

  2. If anything is checked, deselect everything.

  3. Uninstall any installed Android SDK Build-tools

  4. Now install the Android SDK Build-tools with latest Revision (at the moment Rev. 28.0.3)

I also updated the Android SDK Tools and Android SDK Platform-tools

Now rebuild your Project and it should work without any errors!
Hope this is helpful

3 Likes

Thank you so much for sharing this! it fixed my problem.

You saved me !!! Thanks !!!

how do you rebuild your project?

Not working for me. I update tools and platforms as well. But the same error.
ERROR: ERROR: cmd.exe failed with args

From July 2019
Dont use build tools Rev.29 or later,Rev.28 is OK.
不要使用Rev29或者以后的版本,会出现相同的问题。

thx, it works for me

I am getting a similar in 4.24 but the Enable Gradle instead of Ant option is missing in my version

3 Likes

I know this is a later version, but wanted to share since these posts appeared in my search for a solution: I had this problem with 4.25 for a week, trying on two laptops with zero success. Found this video , titled: UNREAL ENGINE 4.25.1 PACKAGING FOR ANDROID TUTORIAL UPDATED! : UNREAL ENGINE 4.25.1 PACKAGING FOR ANDROID TUTORIAL UPDATED! - YouTube

I removed all of the files for android studio and codeworks (which took some work for some reason) and started with this process from scratch, also installing JDK 15 fresh.

It worked. The “cmd.exe failed with args /c” failure is gone. I hope this works for you. I spent a week looking for the answer, and this 20 minute step-by-step setup solved the problem.

side note: my desktop system has not had this issue at all, and is still set up differently, for some reason the laptops would not work unless this exact setup is in place.

2 Likes

What eventually fixed it for me was deleting the Intermediate folder and then relaunching the project.

Found the answer here:

2 Likes

I had this problem, for me I had to increase the heap size.

Go to: Unreal[PROJECTNAME]\Intermediate\Android\armv7\gradle
Open: gradle.properties with notepad or other textwriter
Change: org.gradle.jvmargs=-XX:MaxHeapSize=4096m -Xmx9216m To somthing like XX:MaxHeapSize=8096

Hope this helped.

I set location of java in ANDROID SDK to C:/NVPACK/jdk1.8.0_77/jre and it worked.

its worked for me. thanks

Also got the “ERROR: cmd.exe failed with args /c” with version 4.26.1 and I fixed it by simply deleting the content of the ProjectName/Intermediate folder. xD

This is the simplest and the best solution for me
Thank you~!

I’ve fixed it by deleting the Intermediate/Anrdoid/arm7 (or gradle) folder, even sometimes deleting just the gradle.bat file.

For newest intallations use solution from

jdk-8u291-windows-x64 ( jre1.8.0_291 ) from Java SE Development Kit 8 - Downloads
+
android-ndk-r21e from NDK Revision History | Android NDK | Android Developers