March 10, 2020
Updates to required setup for Android NDK 21 in Unreal Engine 4.25
Greetings from the Unreal Engine Mobile team! Today, we’re bringing you an update concerning setup for your Android development environment in 4.25 and onward.
Specifically, Unreal Engine 4.25 now requires Android Native Development Kit Revision 21 (NDK r21) to support the development of Android projects. This requires a new setup process using Android Studio instead of Codeworks for Android 1R7u1. While we will be publishing new documentation for this process for 4.25’s full release, we wanted to share the new setup steps ahead of time for those using 4.25 preview builds.
Recommended SetupYou 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, as well as delete the folder CodeWorks was installed to, before proceeding with further setup to ensure that your environment variables will be set correctly. Otherwise, Android Studio will continue to use the previous CodeWorks installation folder for SDK updates. The default installation directory for CodeWorks is C:/NVPACK.
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 section on Using Earlier NDK or Unreal Versions below.
1. Installing Android StudioTo set up the required NDK components on your computer, you need to install Android Studio version 3.5.3.
- Navigate to the Android Studio Archive page in your web browser. Scroll down to Android Studio 3.5.3, click on it to unfold the dropdown, and download the appropriate installer or zip file for your operating system.
- Run the Android Studio installer. In the Welcome to Android Studio Setup dialogue, click Next to continue.
- In the Choose Components dialogue, click Next to continue. You can leave the default components enabled.
- In the Configuration Settings dialogue, select an appropriate install location and click Next to continue. We recommend using the default location.
- In the Choose Start Menu Folder, click Install to begin the installation process.
- When the installation finishes, click Next to begin setting up components.
- 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 UseWhen you start Android Studio for the first time, follow these steps:
- When the Import Android Studio Settings dialog appears, select do not import settings and click OK to continue.
- 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.
- 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.
- In the Install Type dialog, select Standard and click Next.
- In the Select UI Theme dialog, choose your preferred theme and click Next.
- In the Verify Settings dialog, click Finish to finalize your setup and begin downloading components.
- When components are finished downloading, click Finish again to end setup.
If you are using Windows, restart your computer for all settings to take effect. If you are using Linux, close your terminal window and reopen it. If you are using a Mac, you can either close your terminal window and reopen it or log out and log back in. You must do this before moving on to the next section.
3. Setting Up Unreal to Use NDK r21To set up Unreal Editor to use Android NDK r21:
- Navigate to your Unreal 4 engine install directory. For example, C:/Program Files/Epic Games/UE_4.25.
- Open Engine/Extras/Android.
- 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.
- You will be prompted to accept the Android SDK license agreement. Type Y and press Enter to accept.
- When the installation completes, press any key to dismiss the command prompt and finish the process.
This script will download and install NDK r21 for you in your Android home directory. The install directory should be C:/Users/Username/AppData/Local/Android/Sdk/ndk/21.0.6113669, where “Username” is your login name for your computer.
Using Earlier NDK or Unreal VersionsIn the event that you require an installation of Unreal Engine 4.24 or older, or that your project needs to target an earlier version of Android NDK not supported by this installation process, you can manually set your environment variables to target the version you need. In Unreal Editor, you will find your Android SDK paths in the Project Settings menu under Platforms > Android SDK.
Alternatively, you can edit the BaseEngine.ini for your engine installation manually under
[NDKInstallPath]is the location of your desired NDK installation.
For the purpose of making your future installations of Unreal Engine as smooth as possible, we recommend using Android Studio per the above installation steps. You can then download NDK r14b from the Unsupported NDK Downloads page on the Android developer site and manually target it in your installations of 4.24 or earlier.
Alternatively, if you want to keep an installation of CodeWorks for earlier projects, you can perform the Android Studio installation above without removing CodeWorks. The SetupAndroid script in 4.25 will still automatically download NDK r21, but you will need to manually target its location in your Unreal 4.25 installation.