Packaging Android Projects

Taking a look at packaging your final Android project.

Windows
MacOS
Linux
Prerequisite Topics

This page assumes you have prior knowledge of the following topics. Please read them before proceeding.

In the following How-To we will take a look how to package your Unreal Engine 4 (UE4) project for deployment to an Android device. The Android packaging process in UE4 is simple to use and outputs several convenient files for installing and uninstalling your project from phones for testing.

Essential Setup

Before we begin, you will need to fulfill the following requirements and project setup:

If you have not already created a project, create one using the Third-Person Template, with Target Hardware set to Mobile/Tablet and quality set to Scalable 3D or 2D.

1. Packaging Your Project

In this section we will package the project as a .APK file.

We are currently packaging in Development because we are testing this game, but when your game is complete, you can package it in Shipping by hovering over the Build Configurations option in the Package Project menu.

  1. In the File menu, go to Package Project > Android and select the Texture format you want to package. For this example, we will choose Android ETC1 as it is supported by all devices.

    Click to enlarge image.

    Different devices support different Texture formats depending on the hardware they run on. See, Android Development Reference for a detailed breakdown of the various formats.

    Format

    Description

    ETC1

    Supported by all Android based devices but cannot compress alpha textures (they are stored uncompressed). Recommend using an RGB and a separate alpha texture if need alpha to get better compression.

    ETC1a

    Uses ETC1 for non-alpha textures and ETC2 for alpha texture. If the device does not support ETC2, alpha textures will be uncompressed into RGBA at runtime. This format can be used on both ETC1 and ETC2 devices, but ETC1 for non-alpha textures may not be as high-quality as ETC2.

    ETC2

    Supported by all OpenGL 3.x class devices and supports alpha compression.

    ATC

    Supported by Qualcomm Adreno GPUs and supports alpha compression.

    DXT

    Supported by Nvidia Tegra GPUs and supports alpha compression.

    PVRTC

    Supported by PowerVR GPUs and supports alpha compression.

    ASTC

    Latest Texture compression format allowing more quality control by specifying block size and supports alpha compression. Available on some devices at this point.

  2. You will be prompted for a location to save your packaged game, which should default to your project folder. Create a new folder and call it Android_Builds.

    Click to enlarge image.

  3. While your project is being packaged a packaging message will appear in the bottom right corner showing the progress of the packing.

    package_toast.png

  4. Once packaging is successful, a Packaging Complete message will appear in the bottom right of the editor.

    Packageing_Completed.png

  5. Navigate to the folder you created in step two. There will be a new folder named specifically for the texture type you selected when packaging. In this example, the folder is named Android_ETC1.

    Click to enlarge image.

2. Deploying A Packaged Project to Device

Now that we have packaged your project as a .APK, this section will instruct you on how to deploy your build to a device.

  1. Plug your Android device into your PC with a USB cable. If prompted, allow your PC to change files.

  2. Open up the Android_ETC1 folder and then Double-click on the Install[ProjectName]Development.bat batch file to install the project on your Android device.

Click to enlarge image.

If you do not have your device plugged in via USB, running the .BAT file will do nothing.

  1. Plug your Android device into your PC with a USB cable. If prompted, allow your PC to change files.

  2. Open up the Android_ETC1 folder and then Double-click on the Install[ProjectName]Development_armv7-es3.command file to install the project on your Android device.

    If you do not have your device plugged in via USB, running the .command file will do nothing.

  1. Plug your Android device into your PC with a USB cable. If prompted, allow your PC to change files.

  2. Open the Android_ETC1 folder, where you'll find the files that were created during the packaging process.

    LinuxAndroid_Step37.png

    You should see the Installation and Uninstallation shell scripts (.sh) along with the Android Application Package (.apk) that contains all of the files you need to install the project onto any Android device that supports the ETC1 compression scheme.

  3. Now, open up the terminal from this folder's location by right-clicking inside of the folder and selecting Open in Terminal.

    LinuxAndroid_Step38.png

  4. Enter ./Install_LinuxAndroidProject_Development-arm64.es2.sh into the terminal to install the project onto your Android device.

    Click to enlarge image.

    If you're having trouble running the shell script, try entering adb devices into the terminal to verify that your device is connected to your computer.

  5. During the installation process, the shell script should flush the following output to your terminal

    Click to enlarge image.

    When the shell script has completed the installation process, you should see an Installation successful message.

When you have completed this How-To, your project should appear on your Android device per the following image:

In addition, you will have packaged .APK files and accompanying helpers to deploy them to other devices for testing.

Packaging App Bundles

Android App Bundles are a distribution format offered by Google as an alternative to packaging .apks. Instead of creating different .apks for different subsets of devices, you can create a single Android App Bundle build (.aab) and upload it to the Google Play Store. The store's dynamic distribution system then uses the contents of the App Bundle to generate a .apk optimized for the user's specific device when they download the application.

In addition to greatly condensing the work involved in maintaining builds on the Google Play Store, App Bundle builds can distribute .apks with up to 150 MB instead of the previous limit of 100 MB. This limit applies to the final .apk and not the App Bundle used to generate it.

To create an App Bundle Build, open your Project Settings and navigate to the Platforms > Android section. In the App Bundles section, enable Generate Bundle (AAB).

Generate AAB settings

Now when you package a project for Android, you will generate a .aab file to upload to Google Play. You will also generate a universal .apk for testing purposes.

As a limitation of the Google Play Store, Android App Bundles can not be distributed with .obb files.

The other settings available for configuring App Bundle builds enable you to fine-tune the degree of sensitivity that the App Bundle will use in generating the final .apks for your project.

Setting

Description

Generate Universal APK from Bundle

Enabling this setting will allow the App Bundle to generate a universal .apk file for end-users, which can be run on any kind of device. This does not affect the universal .apk that is generated for testing on your machine.

Enable ABI Split

The App Bundle will generate separate .apks based on the Application Binary Interface used by the user's CPU. For example: arm64-v8a, x86, x86_64.

Enable language split

The App Bundle will generate separate .apks based on the user's language. Only strings localized for the user will be downloaded.

Enable density split

The App Bundle will generate separate .apks based on image resolution and DPI. Only icons and splash screens compatible with the user's device will be downloaded.

As an example, if you enabled ABI split but disabled language split, the .aab would tailor the final APK to a user's device based on the compatible ABI for their device, but every user would receive resources for all languages regardless of their device or language settings.

The default settings will result in the smallest possible size for the final .apk, while disabling these settings will result in larger .apks.

For information on how to upload either .apks or .aabs to the Google Play Store, refer to our guide on Shipping with Android .

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