How to fix Android setup problems in UE

Packaging games for Android in Unreal Engine may be tricky. In this post, I share the steps I take to set up the development environment for UE 4.27 and UE 5.1.

Installing Android Studio

First, follow the steps in the UE documentation to set up the Android development environment on your PC.

It tells you to use Android Studio 4.0 exactly, but I downloaded version 4.2.2 and it works fine.

If you experience issues with the Android Studio after installation, you can also try to download it through the JetBrains Toolbox. It seems to do a proper setup for you.

Setting up Command-Line Tools

For UE 4.27-5.1 install an SDK Platform with the maximum API Level being 30.

Pic 1. Installing SDK Platforms in the Android Studio SDK Manager

Install the SDK Build Tools with the maximum version being 30.0.3. If you install any SDK above this version, it will cause errors when packaging for Android.

If you can’t see the specific SDK versions, make sure to select the “Show Package Details” checkbox.

Pic 2. Installing SDK Build Tools in the Android Studio SDK Manager

Max Android Build Tools for UE 4.27 is 30.0.3. For higher versions use the latest source version of the Engine from GitHub branch 4.27-plus.

Install the Android SDK Command-line Tools 9.0. The documentation insists on installing version 8.0, but the latest works fine for me.

Pic 3. Installing SDK Command-line Tools in the Android Studio SDK Manager

With the latest Command-line Tools, you probably don’t need to amend the SetupAndroid.bat as the documentation asks you. But to be sure, open the file (located in <path_to_your_UE>\Engine\Extras\Android\SetupAndroid.bat) and search for: 

set SDKMANAGER=[...]

If you installed the SDK in the default location, the path to the SDK Manager should look like this:

C:\Users\GaidaSan\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat

If you installed the SDK somewhere else or a different version than the latest, find the installation folder and update the path in the SetupAndroid.bat.

You can always check what path the script is trying to use by pasting the following code inside the .bat file:

SetupAndroid.bat
echo Using sdkmanager: %SDKMANAGER%
Batch

Setting up Android in UE project

Open your UE project, go to the Project Settings -> Platforms -> Android SDK, and set up paths to the Android SDK as follows:

Pic 4. Setting up paths to the Android SDK, NDK, and Java in Project Settings
Android SDK = C:/Users/GaidaSan/AppData/Local/Android/Sdk
Android NDK = C:/Users/GaidaSan/AppData/Local/Android/Sdk/ndk/21.4.7075529
Java = C:/Program Files/Android/Android Studio/jre

As you can see these are the default SDK installation locations. If you changed them during installation, you must paste your paths here. 

The NDK is installed inside the SDK and its path should include the version number. Java Runtime Environment (JRE) is installed in the Android Studio folder. Also, make sure to change the “GaidaSan” with your Windows user name.

Now go to the Project Settings -> Platforms -> Android and configure platform files to be writable. If you use Google Play Services, make sure to do the same in the Google Play Services category.

Pic 5. Configuring platform files for Android

Set the Minimum and Target SDK versions to 30. You can adjust it to your setup if you installed other Android SDKs.

Pic 6. Setting the Minimum and Target SDK version

Keep in mind that you may experience rendering problems in older Android versions, especially when the OpenGL changes (OpenGL ES 3.0 in API Level 18 and OpenGL ES 3.1 in API Level 21). You may have to fix these errors for specific hardware. I recommend creating a separate build in such cases. You can upload several versions of the same application to the Google Play. Each version can be targeted to specific hardware.

With the above setup, you should be able to package your game for Android. But if Unreal still opens a page in documentation make sure it can find the right Android SDK and NDK. Check if the paths in Project Settings -> Android SDK are correct. Check if the Minimum and Target SDK match the one you installed on your PC.

Good luck.

UE Developer, with experience in RTS, Platformer and mobile games development.

Team leader with more than 8 years of professional experience as a programmer.

Leave a Reply

Your email address will not be published. Required fields are marked *