Unreal Engine 5 Package Project Android Set up SDK NDK JDK 2024 update

If you are here, that means the "Setting Up Android SDK and NDK for Unreal" official page didn't work for you, the page is clearlly outdated - also, other guides or forum solutions didn't work either - then please be patient and follow the following instructions as written below

If you encounter problems with your set up that means you have some versions of SDK NDK JDK in your system - for the guide to work you need a clean system without any trace (I'm not joking) of the previous SDK NDK JDK - it is not enough to unistall them, you also need to delete the following folders:

C:\Program Files\Android
C:[Your UE project]\Build\
C:[Your UE project]\Intermediate\
C:[Your UE project]\DerivedDataCache

also, open “This PC”, right-click in the empty space inside the window, and select “Properties”, in the opened window, select “Advanced system settings” > “Environment Variables”, delete the following environment variables:

Restart your PC.

To Solve and Fix multiple packaging errors, you need to understand that the Android Studio 4.0 from May 28, 2020 - is the ONLY version that will work, it doesn't matter what others have said - this is a huge problem because people can not belive that ONLY a specific version will work and all the other versions will give errors when packaging - this is the truth for all UE versions between 4.27 to 5.4 - also do not download or install other NDK and JDK - Android Studio 4.0 from May 28, 2020 will provide the ONLY functional NDK and JDK versions for Unreal Engine

https://developer.android.com/studio/archive - Here, in the Android Studio download archives, you can find the Android Studio 4.0 from May 28, 2020

Now, let's start - install the Android Studio 4.0 from May 28, 2020 - follow the installer instructions, do not check an extra box, just do the basic install - after the installation is completed - you need to set the JAVA_HOME “Environment Variables” to point to the JAVA version inside the Android Studio 4.0 (inside the install folder from Android Studio 4.0 is a folder ‘jre’, with JAVA version 1.8.0_242 , that’s the ONLY version that works) - set JAVA_HOME “Environment Variables” to the folder ‘jre’

Now open Android Studio 4.0 - open the Configure dropdown and click SDK Manager, click the SDK Tools tab, check the box for Android SDK Command-line Tools version 8.0 (this is the only version that works, do not install other versions). Click Apply to download and install this component, after that, click OK to dismiss the window and close the welcome dialog.

Restart your PC.

Setting Up Android NDK - go to C:/Program Files/Epic Games/UE(your engine version)/Engine/Extras/Android/SetupAndroid.bat - open the SetupAndroid.bat with a text program like Notepad make sure that in the file the text says "cmdline-tools\8.0" - if the text says "cmdline-tools\latest" replace it with "cmdline-tools\8.0" - before making changes to it make sure the file is not Read only, if it is, open the file Properties, uncheck the tick box and apply - next run the SetupAndroid.bat it will instal the ONLY NDK version that will work.

Now, open the cmd and run ‘C:\Users\YourUserName\AppData\Local\Android\SDK\tools\bin\sdkmanager.bat --licenses’ Type Y and press Enter to accept.

Inside Ureal Engine chose ‘Target SDK version’ to 30 (won’t work with any version below 30)

Restart your PC.

Now packaging should work. I hope the solution above works for your project without any problems, if you encounter problems, leave a comment and I will try to help you.

Below are some common errors for a broken Android Set up of SDK NDK JDK

ERROR: cmd.exe failed with args /c “C:\-\Intermediate\Android\armv7\gradle\rungradle.bat” :app:assembleDebug.

ERROR: Android toolchain NDK r25c not supported; please use NDK r21 to NDK r23 (NDK r21b recommended)

Error: cmd.exe failed with args /c “C:\-\Intermediate\Android\arm64\gradle\rungradle.bat” :app:assembleDebug

PackagingResults: Error: Exception org.codehaus.groovy.GroovyBugError [in thread “Daemon worker”]

PackagingResults: Error: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

UATHelper: Packaging : Could not initialize class org.codehaus.groovy.reflection.ReflectionCache UATHelper: Packaging : Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 [in thread “Daemon worker”]

About Me - I'm an indie game dev, active on Unreal Engine since 2019, I made multiple games for PC and Android platforms - if you want to support a fellow dev, check out my games on Google Play Store - I'm also a music producer and web dev - if you want to follow my projects the links are above. Have a nice day!

Read more articles about Unreal Engine

Unreal Engine 5 Package Project Android Set up SDK NDK JDK 2024 update

Unreal Engine 5 Update Google Play Billing Library 3, 4 or 5 to 6

Unreal Engine 5 androidx.fragment:fragment:1.0.0 outdated

Unreal Engine 5 on Android - Permission Required, Storage, Error Screen