# Cannot build for Android because of Gradle Error

**URL:** <https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428>\
**Category:** Mobile\
**Tags:** Android-Packaging, gradle, Packaging-Failed, urgent, unreal-engine, question\
**Created:** [April 7, 2020, 11:33am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428 "2020-04-07T11:33:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_2636d2e8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2636d2e8](https://forums.unrealengine.com/u/anonymous_user_2636d2e8)\
**Post date:** [April 7, 2020, 11:33am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/1 "2020-04-07T11:33:39Z")

</div>

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 the error that I keep getting : UATHelper: Packaging (Android (DXT)): ERROR: cmd.exe failed with args /c “C:\Users[PC NAME]\Documents\Unreal Projects\Teleport 4.24\Intermediate\Android\APK\gradle\rungradle.bat” :app:assembleDebug

Things I have tried (after searching solutions on internet)

- Making Sure I accepted the SDK Liscence
- Downloading and Installing Android-28 (as the compiler said it was needed and recommended, and sdk installed  
has upto Android-26 api level only)
- Making sure firewall or Antivirus is not blocking UE4
- Changing apk name
- Installing and running with ndk-16b and ndk-18b (newer versions)
- Installing Gradle 4.6 (newer gradle version)
- Deleting gradle cache file
- Deleting the intermediate folder in project file and then compiling (it comes back with same error)

Please Note : Earlier when I did android development with UE4V18.1 , I still had problems with gradle so i used ‘ant’ instead. But now that ant has become obsolete, I don’t have that option.  
Kindly help me, I can’t waste any more time on just packaging.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2636d2e8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2636d2e8](https://forums.unrealengine.com/u/anonymous_user_2636d2e8)\
**Post date:** [April 7, 2020, 11:37am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/2 "2020-04-07T11:37:34Z")

</div>

PS: I also tried to package as ATC, ETC1 - no luck ☹

---

<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:38am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/3 "2021-01-15T05:38:30Z")

</div>

May be this helps someone

I solved it by deleting the directory under which it expected the aapt2 executable, e.g. “C:\Users\support.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\4c1f5b7dca1d5d378360be7f3fd9726a” and then i removed save and intermediate folders of my project. after that i connect my computer to the internet and and start building my project for android Afterwards it appears to have downloaded this again, with the missing executable, and now works perfectly.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ab0a3ef](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ab0a3ef](https://forums.unrealengine.com/u/anonymous_user_9ab0a3ef)\
**Post date:** [February 22, 2021, 9:54am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/4 "2021-02-22T09:54:30Z")

</div>

Hi, did you get it to work yet

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9ab0a3ef](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9ab0a3ef](https://forums.unrealengine.com/u/anonymous_user_9ab0a3ef)\
**Post date:** [February 28, 2021, 5:21pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/5 "2021-02-28T17:21:11Z")

</div>

Hi I am a bit new , can you please brief me on this. I have been going nuts over this

---

<div class="post-metadata">

**Author:** ![araz01](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/araz01/32/1028814_2.png) [@araz01](https://forums.unrealengine.com/u/araz01)\
**Post date:** [May 19, 2021, 10:43am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/6 "2021-05-19T10:43:14Z")

</div>

C:\Users(YourUserName).gradle (Delete Tis Ting)

---

<div class="post-metadata">

**Author:** ![ooghe](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ooghe/32/765288_2.png) [@ooghe](https://forums.unrealengine.com/u/ooghe)\
**Post date:** [July 21, 2021, 5:20pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/7 "2021-07-21T17:20:38Z")

</div>

How does one delete .gradle so that it stays deleted? If I remove it, it just appears again during the build, and creates the same error.

 ![344654-gradlecreated.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/1/e710f8fba077ac8ba982ee6a5b26f4cba1484ad2.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_67fd1278](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_67fd1278](https://forums.unrealengine.com/u/anonymous_user_67fd1278)\
**Post date:** [August 10, 2021, 7:12pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/8 "2021-08-10T19:12:45Z")

</div>

Hi, You can refer to this video:

  
gradle error is usually a symptom of another issue (usually a misconfiguration of the android SDK level relative to the engine)

For me, I followed the unreal documentation to install Android studio 4.0.0 (recently updated) this installed the SDK Build Tools 31, which are not supported with 4.26. I had to downgrade the build tools to v30 and reconfigure the SDK/NDK level in project settings to latest/android-19

---

<div class="post-metadata">

**Author:** ![SpaceCat86](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/spacecat86/32/634357_2.png) [@SpaceCat86](https://forums.unrealengine.com/u/SpaceCat86)\
**Post date:** [April 15, 2022, 11:52pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/9 "2022-04-15T23:52:56Z")

</div>

Hi,  
Unfortunately, following unreal documentation didn’t help me. It seems that step 3.3 that asked you to run the SetupAndroid.bat file installing the wrong version. So here is what I did to get around the gradle error.

- Installed Android 10 API level 29  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/a/38a1e478058ce389c5ead21d67b293b76a997e44.png)

-installed 29.0.3 Android SDK build tools

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/7/21747009559d4c3f28dcdc184e3c9d766907d78e.png)

-Manually target the paths in Platforms Android SDK

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/5/f/85f0267d2a0634c13887f855033dec48f2766027.png)

---

<div class="post-metadata">

**Author:** ![mawilbolou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mawilbolou](https://forums.unrealengine.com/u/mawilbolou)\
**Post date:** [April 23, 2022, 8:41am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/11 "2022-04-23T08:41:23Z")

</div>

Hi. Ive got exactly the same issue. The support for android development is appauling in Unreal. The documentation seems to not be revelant.  
Ive tried removing all android installation using this method

> **[How to Completely Uninstall Android Studio on Windows? - GeeksforGeeks](https://www.geeksforgeeks.org/how-to-completely-uninstall-android-studio-on-windows/)**
>
> A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

And reinstalling.  
When i install again the sdk is greyed out, my phone isnt recognised and the exclamation mark in the android packaging menu is present.

---

<div class="post-metadata">

**Author:** ![BladeStone69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BladeStone69](https://forums.unrealengine.com/u/BladeStone69)\
**Post date:** [April 24, 2022, 10:29am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/12 "2022-04-24T10:29:19Z")

</div>

yip , no support from epic at all , I am struggling with the same problem

---

<div class="post-metadata">

**Author:** ![BladeStone69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BladeStone69](https://forums.unrealengine.com/u/BladeStone69)\
**Post date:** [April 28, 2022, 3:35pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/13 "2022-04-28T15:35:08Z")

</div>

I tried this , not working for me also. thx

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9dd78251](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9dd78251](https://forums.unrealengine.com/u/anonymous_user_9dd78251)\
**Post date:** [June 11, 2022, 11:42pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/14 "2022-06-11T23:42:33Z")

</div>

I am also facing these problems @anonymous_user_0b3b7c33 **must look toward this problem** all many developers may **get away from using Unreal Engine** ☹

---

<div class="post-metadata">

**Author:** ![farzan\_miro](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@farzan\_miro](https://forums.unrealengine.com/u/farzan_miro)\
**Post date:** [June 14, 2022, 6:42pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/15 "2022-06-14T18:42:24Z")

</div>

the problem with gradle and android development is very old . i don’t understand why there is no fix for it after all this time . this is a really important issue .

---

<div class="post-metadata">

**Author:** ![RAvIYa\_SL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAvIYa\_SL](https://forums.unrealengine.com/u/RAvIYa_SL)\
**Post date:** [July 22, 2022, 3:07pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/16 "2022-07-22T15:07:21Z")

</div>

How to fix it help me

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9dd78251](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9dd78251](https://forums.unrealengine.com/u/anonymous_user_9dd78251)\
**Post date:** [August 25, 2022, 1:18am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/17 "2022-08-25T01:18:14Z")

</div>

> [@Android packaging Error - Error:cmd.exe failed with args](https://forums.unrealengine.com/t/android-packaging-error-error-cmd-exe-failed-with-args/579481):
>
> Actually, I get bored trying to build an Android Game please any professional ANDROID DEV. see my errors And tell me what I have to do or Download … … … THE ERROR: … ANDROID STUDIO: … … AND THANKS,

this could help

---

<div class="post-metadata">

**Author:** ![A1MOHND.Dev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/a1mohnd.dev/32/467298_2.png) [@A1MOHND.Dev](https://forums.unrealengine.com/u/A1MOHND.Dev)\
**Post date:** [March 31, 2023, 2:10am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/18 "2023-03-31T02:10:45Z")

</div>

hello everyone I had the same problem in ue5.1 and I solved it.

- make sure that you are using JDK 8u77 (1.8.0\_302) also check that its JDK, not JRE  
-make sure that you set JAVA\_HOME and ANDROID\_HOME  
-make sure that you are using android studio 4.0
- Use NDK 25.1.8937393 for unreal  
-here are some images of my settings  
 ![1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/3/e53cfc4c5b8f9e280c4a3cf572c4f25e63ab1bdc.png)  
 ![4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/2/5/b253e29050ff28263ba83f592c9e56ace2d82436.png)  
 ![5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/3/22330a46974803a1f00847e689ded1a18ae20ceb.png)  
 ![6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/0/d2017bf5bd6db04686a546e7e61b588c42ff184c.png)  
 ![7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/d/5/7d50f0455e1acdc5afa2068bcc52a51223b7ad2b.png)

---

<div class="post-metadata">

**Author:** ![SpaceCat86](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/spacecat86/32/634357_2.png) [@SpaceCat86](https://forums.unrealengine.com/u/SpaceCat86)\
**Post date:** [April 8, 2023, 3:15am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/19 "2023-04-08T03:15:05Z")

</div>

Following this instruction helped me.

 ![Screenshot (4)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/0/5/5057f0121f1b6ef747abe5466e98b5a6183bb48f.png)

---

<div class="post-metadata">

**Author:** ![Lungy111](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lungy111](https://forums.unrealengine.com/u/Lungy111)\
**Post date:** [December 4, 2023, 6:56pm UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/20 "2023-12-04T18:56:45Z")

</div>

I found out my work VPN is blocking Gradle. Just had to disable VPN temporary during my build.

---

<div class="post-metadata">

**Author:** ![122qiu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@122qiu](https://forums.unrealengine.com/u/122qiu)\
**Post date:** [January 24, 2024, 5:18am UTC](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428/21 "2024-01-24T05:18:47Z")

</div>

work for me, thx 😀. Although the build-tools of 29.0.2 are still automatically downloaded.  
UE 4.47.2, Andriod Studio 4.0.0.

[Next page](https://forums.unrealengine.com/t/cannot-build-for-android-because-of-gradle-error/463428.md?page=2)
