Cannot build for Android because of Gradle Error

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.

2 Likes

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

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.

1 Like

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

1 Like

Hi, did you get it to work yet

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

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.

1 Like

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

1 Like

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 29.0.3 Android SDK build tools

-Manually target the paths in Platforms Android SDK

2 Likes

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

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.

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

I tried this , not working for me also. thx

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

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 .

2 Likes

How to fix it help me

this could help

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

Following this instruction helped me.

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

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