# ERROR: cmd.exe failed with args Gradle

**URL:** <https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061>\
**Category:** Platform & Builds\
**Tags:** error, apk, gradle, build, unreal-engine, question\
**Created:** [June 6, 2020, 8:43pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061 "2020-06-06T20:43:24Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kwixb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kwixb](https://forums.unrealengine.com/u/Kwixb)\
**Post date:** [June 6, 2020, 8:43pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/1 "2020-06-06T20:43:24Z")

</div>

Hello, I am running into a weird error when I try to build out my game to Android (ASTC) for Oculus Quest.

`UATHelper: Packaging (Android (ASTC)): ERROR: cmd.exe failed with args /c "S:\Unreal Projects\[GAME]\Intermediate\Android\APK\gradle\rungradle.bat" :app:assembleDebug UATHelper: Packaging (Android (ASTC)): Took 29.906301s to run UnrealBuildTool.exe, ExitCode=5 UATHelper: Packaging (Android (ASTC)): UnrealBuildTool failed. See log for more details. (C:\Users\kenda\AppData\Roaming\Unreal Engine\AutomationTool\Logs\S+Program+Files+Epic+Games+UE_4.24\UBT-[GAME]-Android-Shipping.txt) UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=5 (5) UATHelper: Packaging (Android (ASTC)): BUILD FAILED PackagingResults: Error: cmd.exe failed with args /c "S:\Unreal Projects\[GAME]\Intermediate\Android\APK\gradle\rungradle.bat" :app:assembleDebug PackagingResults: Error: Unknown Error`

**Things to note:**

- I have already tried reinstalling Android Codeworks

- I have already accepted the SDK license

- I was able to successfully make a build using the same settings in a blank project

- Android Studio is already installed

- I’ve cleared the cache in my user folder

Right now, I am not sure what else to do. So help would be greatly appreciated!

Also, here are my apk settings.

 ![303303-settings.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/d/c8ddd4789142e6cae683928cca5c700a4d2bab31.png)

---

<div class="post-metadata">

**Author:** ![nirama](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nirama](https://forums.unrealengine.com/u/nirama)\
**Post date:** [June 11, 2020, 12:43pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/2 "2020-06-11T12:43:45Z")

</div>

So far, no right answer for this. Trying to package with 4.23, 4.24, 4.25, no luck, even empty project. I’m so frustrated right now.

---

<div class="post-metadata">

**Author:** ![sampyxis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sampyxis/32/586683_2.png) [@sampyxis](https://forums.unrealengine.com/u/sampyxis)\
**Post date:** [July 16, 2020, 11:30am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/3 "2020-07-16T11:30:18Z")

</div>

I had this same problem and took me a while to find something that worked for me.

I’m using 4.25 and have a clean install of Android Studio and Java.

From reading the bug reports on the gradle github - seems that the solution is to download JDK v. 8 - I did this, repointed my Unreal settings to here - and then it worked smoothly.

Hope this answer helps someone.

---

<div class="post-metadata">

**Author:** ![Kwixb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kwixb](https://forums.unrealengine.com/u/Kwixb)\
**Post date:** [July 22, 2020, 3:09am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/4 "2020-07-22T03:09:21Z")

</div>

Unfortunately, there was no luck on my end. It must be something specific with my game, since I’m able to build in other projects.

---

<div class="post-metadata">

**Author:** ![sampyxis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sampyxis/32/586683_2.png) [@sampyxis](https://forums.unrealengine.com/u/sampyxis)\
**Post date:** [July 22, 2020, 6:48am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/5 "2020-07-22T06:48:10Z")

</div>

I was just comparing settings - and seems the only difference is the minimum SDK version (I’m using 19).

Maybe that could be the issue…

 ![307786-annotation-2020-07-22-084617.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/b/e/0bed88d279eaf8b852b57c066b7eddd8c5f3dd7c.png)

---

<div class="post-metadata">

**Author:** ![Kwixb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kwixb](https://forums.unrealengine.com/u/Kwixb)\
**Post date:** [September 5, 2020, 2:42am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/6 "2020-09-05T02:42:08Z")

</div>

Sadly, it’s still failing with the same error. The only other difference I see is that you’re not packaging your game inside an apk, which I am.

---

<div class="post-metadata">

**Author:** ![ChrisDodds](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ChrisDodds](https://forums.unrealengine.com/u/ChrisDodds)\
**Post date:** [October 15, 2020, 6:01am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/7 "2020-10-15T06:01:01Z")

</div>

I spent a day fighting the same problem. I had been successfully building for android for months then I started getting gradle errors. I thought maybe it was due to project size or upgrading to Unreal 25.3. I reloaded Android Studio, reviewed every build setting, editing ini files, all with no success. Then I backed up my project and deleted the Saved directory. That fixed it.  
Very frustrating problem to solve and in hindsight I wish I had started with deleting the Saved and Intermediate folders. So I thought I would share this in case it can help someone else.

---

<div class="post-metadata">

**Author:** ![Kwixb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kwixb](https://forums.unrealengine.com/u/Kwixb)\
**Post date:** [October 15, 2020, 2:44pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/8 "2020-10-15T14:44:42Z")

</div>

Thanks for reaching out! I have tried deleting those directories before with no luck. Perhaps, I will try it again!

---

<div class="post-metadata">

**Author:** ![SculptorM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SculptorM](https://forums.unrealengine.com/u/SculptorM)\
**Post date:** [October 17, 2020, 5:37pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/9 "2020-10-17T17:37:24Z")

</div>

I had this problem 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](https://www.youtube.com/watch?v=4SY2Za6j7UY)

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.

---

<div class="post-metadata">

**Author:** ![Samush](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Samush](https://forums.unrealengine.com/u/Samush)\
**Post date:** [October 18, 2020, 6:44pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/10 "2020-10-18T18:44:12Z")

</div>

In my case was about minimun SDK version, I only can package on 26 or upper but idk why.

---

<div class="post-metadata">

**Author:** ![dark\_ness04](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dark\_ness04](https://forums.unrealengine.com/u/dark_ness04)\
**Post date:** [January 5, 2021, 3:19pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/11 "2021-01-05T15:19:16Z")

</div>

I had the same issue. Try this:

1. Go to your project folder
2. search for .apk
3. delete all .apk files (not the files that only contain apk in their names), especially a file that contains “debug” and “.apk”
4. Package project 5. Success

---

<div class="post-metadata">

**Author:** ![BirukLala](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BirukLala](https://forums.unrealengine.com/u/BirukLala)\
**Post date:** [January 15, 2021, 5:56am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/12 "2021-01-15T05:56:47Z")

</div>

cheack out this

> **[Cannot build for Android because of Gradle Error](https://forums.unrealengine.com/questions/953168/cannot-build-for-android-because-of-gradle-error.html)**
>
> I know this question has been taken up on the internet forums but none of them have a proper solution that works. I have a game made for android for years but cannot even package it as an apk. Been trying to figure it out for weeks now ! This is...

---

<div class="post-metadata">

**Author:** ![BORIS.britva](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BORIS.britva](https://forums.unrealengine.com/u/BORIS.britva)\
**Post date:** [January 17, 2021, 6:39am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/13 "2021-01-17T06:39:15Z")

</div>

Thanks, i deleted Intermediate and it help

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e907e5b1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e907e5b1](https://forums.unrealengine.com/u/anonymous_user_e907e5b1)\
**Post date:** [February 16, 2021, 9:43am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/14 "2021-02-16T09:43:34Z")

</div>

Deleting Saved and Intermediate worked for me. Thanks!  
(UE4.26 on Win10. Laptop: Razer Blade 15 Base 2020)

---

<div class="post-metadata">

**Author:** ![catonice](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/catonice/32/88708_2.png) [@catonice](https://forums.unrealengine.com/u/catonice)\
**Post date:** [May 30, 2021, 8:10am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/15 "2021-05-30T08:10:16Z")

</div>

This worked for me - deleted Saved and Intermediate folders and was able to package again! (When I ran it the first time I had issues with SDK locations etc. I believe following the YT Tut for packaging Android can work but instead of using open jdk I installed java via Chocolatey which handles a lot - you should still follow his steps in any case - Oracle can suck a D for making things so difficult now (or UE4 but my main bet is Oracle))

Some other hot tips:

> **[OBB file exceeds 2GB error Unreal - Programmer Sought](https://www.programmersought.com/article/32741680972/)**
>
> OBB file exceeds 2GB error Unreal, Programmer Sought, the best programmer technical posts sharing site.

REMEMBER TO RUN THE ANDROID BAT FILE IN UE4\> ENGINE \> Extras \> Android

---

<div class="post-metadata">

**Author:** ![samad5thcool123](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@samad5thcool123](https://forums.unrealengine.com/u/samad5thcool123)\
**Post date:** [July 23, 2021, 8:05pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/16 "2021-07-23T20:05:52Z")

</div>

100%worked  
(1) install Extras

![344764-capture223.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/a/25a13564c0504d72937706ac630f17943216af78.jpeg)

(2) delete the folder android-ndk-r18b  
Location C:\NVPACK

 ![344763-156.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/d/12dfddc3ca53a3bbde95c9d3988d7ae3d26d7eb2.jpeg)

(3) download android-ndk-r21e  
link [Descargas de NDK &nbsp;|&nbsp; NDK&nbsp;de&nbsp;Android &nbsp;|&nbsp; Android Developers](https://developer.android.com/ndk/downloads)

(4) copy android-ndk-r21e to C:\NVPACK  
again

(5) package project again

Have fun

---

<div class="post-metadata">

**Author:** ![DaleBosio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DaleBosio](https://forums.unrealengine.com/u/DaleBosio)\
**Post date:** [November 11, 2021, 1:25pm UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/22 "2021-11-11T13:25:54Z")

</div>

Had exactly the same issue. For me, installing proper version of Java fixed this issue, so now I have following:  
UE4 4.27.1  
Java JDK 1.8.0\_202  
Android SDK 28.0.0. and 29.0.2  
Android NDK 21.0.6113669  
Device: Galaxy S20  
I can launch project on device and I can create package.

---

<div class="post-metadata">

**Author:** ![YnnerjoYn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@YnnerjoYn](https://forums.unrealengine.com/u/YnnerjoYn)\
**Post date:** [March 2, 2022, 2:10am UTC](https://forums.unrealengine.com/t/error-cmd-exe-failed-with-args-gradle/466061/23 "2022-03-02T02:10:05Z")

</div>

I got the same problem, but the JDK version of 1.8.0\_202 fixed this issue. Thank you.
