Setting Up Android SDK and NDK for Unreal

How to set up your Android development environment for Unreal 4.25 and later

Windows
MacOS
Linux

Unreal Engine 4.25 and later uses the Android Software Development Kit (SDK) distributed with Android Studio for all essential Android development components, including the Android Native Development Kit (NDK). This page provides a walkthrough for setting up Android Studio and ensuring that Unreal Engine recognizes these components correctly, and some troubleshooting tips for managing NDK installations and earlier engine builds.

Recommended Setup

You should make sure that the Unreal Editor and the Epic Games Launcher are both closed to ensure that there are no problems with either the installation of NDK components or setting your environment variables for the engine.

If you are moving to Unreal 4.25 from 4.24 or earlier, we recommend that you uninstall CodeWorks for Android and any existing NDK components, and delete the folder CodeWorks was installed to. Otherwise, Android Studio will continue to use the previous CodeWorks installation folder for SDK updates.

The default installation directory for CodeWorks is C:/NVPACK. Make sure this folder is deleted when you finish uninstalling CodeWorks.

If you need to support an earlier installation of Unreal Engine while also maintaining an installation of Unreal 4.25 or later, refer to the sections on Manually Targeting SDK Paths and Android NDK Compatibility below.

1. Installing Android Studio

Before setting up the required SDK and NDK components on your computer, you need to install Android Studio version 3.5.3.

  1. Navigate to the Android Studio Archive in your web browser. Scroll down to Android Studio 3.5.3, click to unfold the dropdown, and download the appropriate installer or zip file for your operating system.

    Click image for full size.

  2. Run the Android Studio installer. In the Welcome to Android Studio Setup dialog, click Next to continue.

    Click image for full size.

  3. In the Choose Components dialog, click Next to continue. You can leave the default components enabled.

    Click image for full size.

  4. In the Configuration Settings dialog, select an appropriate install location and click Next to continue. We recommend using the default location.

    Click image for full size.

  5. In the Choose Start Menu Folder, click Install to begin the installation process.

    Click image for full size.

  6. When the installation finishes, click Next to begin setting up components.

    Click image for full size.

  7. When setup completes, make sure the Start Android Studio box is checked and click Finish to exit the installer.

2. Setting Up Android Studio for First-Time Use

When you start your new install of Android Studio for the first time, follow these steps:

  1. When the Import Android Studio Settings dialog appears, select do not import settings, then click OK to continue.

    Android Studio Setup

  2. When the Data Sharing dialog appears, choose whether or not you want to send usage statistics to Google. This is an option you may choose at your discretion, and either choice will continue to the next step.

    Click image for full size.

  3. The Android Studio Setup Wizard will appear. Click Next to continue. If you are prompted for an update, click the X button to dismiss the prompt, as you need to specifically install version 3.5.3.

    Click image for full size.

  4. In the Install Type dialog, select Custom and click Next.

    Click image for full size.

  5. In the Select UI Theme dialog, choose your preferred theme and click Next.

    Click image for full size.

  6. In the Verify Settings dialog, click Finish to finalize your setup and begin downloading components.

    Click image for full size.

  7. When components are finished downloading, click Finish again to end setup.

Finalizing Android Studio Installation on Your OS

If you are on Windows, restart your computer.

If you are on Linux, close your terminal window and reopen it.

If you are on MacOS, you can either close your terminal window and reopen it, or log out and log back in.

3. Setting Up Unreal to Use Android NDK r21b

  1. Navigate to your Unreal Engine 4 install directory � for example, C:/Program Files/Epic Games/UE_4.25.

  2. Open Engine/Extras/Android.

  3. Inside this directory, run the SetupAndroid script appropriate for your operating system. SetupAndroid.bat is for Windows, SetupAndroid.command is for Mac, and SetupAndroid.sh is for Linux.

    Click image for full size.

  4. You will be prompted to accept the Android SDK license agreement. Type Y and press Enter to accept.

    Click image for full size.

  5. When the installation completes, press any key to dismiss the command prompt and finish the process.

This script will download and install NDK r21b for you in your Android home directory. The install directory for NDK should be C:/Users/[Username]/AppData/Local/Android/SDK/ndk/, where "username" is your login name for your computer. You should see a folder containing NDK r21b.

In the event that you receive an error stating that repositories.cfg cannot be loaded, navigate to the folder where it is expected (usually C:/Users/[Username].android/repositories) and create an empty repositories.cfg file. Android setup should then proceed normally.

If you receive an error stating that a package called lldb;3.1 could not be loaded, open the SetupAndroid script with a text editor, and locate the line of code that reads:

`call "%SDKMANAGER%" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "lldb;3.1" "cmake;3.10.2.4988404" "ndk;21.1.6352462"`

Remove the entry in this list for lldb;3.1, but leave the others. This will enable setup to run normally. This issue is addressed in 4.25.1.

Manually Targeting SDK Paths

If you followed the above how-to sections correctly, Unreal Engine will automatically associate the SDK paths for the Android SDK, the current Android NDK version, and the Java Development Kit (JDK). In the event that you need to manually target your SDK paths, you can find them by opening Edit > Project Settings, navigating to the Platforms > Android > Android SDK section.

Android Studio Setup

When these fields are left blank, they fall back on a set of default paths used by the installation process in the previous sections. If you have multiple installations of these components, or have installed them in non-standard directories, you can manually provide their paths here. Alternatively, you can open DefaultEngine.ini and provide them under the [/Script/AndroidPlatformEditor.AndroidSDKSettings] section.

[/Script/AndroidPlatformEditor.AndroidSDKSettings]
SDKPath = (Path="C:\Filepath")
NDKPath = (Path="C:\Filepath")
JDKPath = (Path="C:\Filepath")

If the entries for SDKPath, NDKPath, and JDKPath do not exist in your DefaultEngine.ini, they will use the default path to the Android home directory.

Android NDK Compatibility

The following table shows which NDK versions are required or compatible with different versions of Unreal Engine.

Unreal Engine Version

Compatible NDK Versions

4.25+

NDK r21b, NDK r20b

4.21 - 4.24

NDK r14b

4.19 - 4.20

NDK r12b

While we recommend using NDK r21b on Unreal Engine 4.25, it also supports NDK r20b to address compatibility issues on some low-end devices.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback