You can launch Unreal Engine (UE) applications for Android on the Android Emulator included with Android Studio, providing a way to test on a wide range of virtual Android devices without relying on a stock of physical devices. Once you have a virtual device set up, launch your application using Unreal Editor or UAT like you would with a physical device. This page provides a guide to:
-
Setting up a virtual device.
- Required specifications for running on Unreal Engine.
-
Launching the virtual device on your desktop.
-
Playing builds of your projects on your virtual device.
-
Debugging on a virtual device.
Set Up a Virtual Device
By default, virtual devices in Android Studio are set up with roughly 256 MB of RAM and a limited amount of internal storage. You need to override these with the following specifications to be able to run Unreal applications reliably:
-
RAM: At least 4 GB
-
Internal Storage: Twice the size of your packaged game.
To create a new device and set it up according to these specifications, follow these steps:
-
Open Android Studio.
-
Open the Device Manager.
-
If you do not have an Android Studio project to load, in the Welcome to Android Studio dialog, click the More Actions dropdown and select **Virtual Device Manager.
-
If you have an Android Studio project open, click Tools > Device Manager.
-
-
When the Device Manager panel appears, click the + symbol and click Create Virtual Device. This opens the Virtual Device Configuration window.
-
In the Virtual Device Configuration window, right-click a profile for an existing device and click Clone. This opens the Hardware Profile Configuration window. This example uses the Pixel 8 Pro as a base.
-
Set the following parameters for your device:
-
Device Name: Rename it using a naming convention that suits your organization. This example adds the suffix
(UE)to denote that this hardware profile is tuned for UE. -
Memory: Set your device's RAM to at least 4 GB.
-
-
Click Finish to return to the Virtual Device Configuration window.
-
Select your custom profile, then click Next.
-
You will be prompted to select a System Image. Select Vanilla Ice Cream or later. Make sure whatever version you choose supports API 35 or later. When you are ready to proceed, click Next.
-
If the System Image you want is grayed out, or if you can't click the Next button after selecting it, click the download button next to the release name, which will install the components needed for that device image.
If you do not use a system image that is compatible with Android 35, you can't run arm64. Instead, you need to target x86-64.
-
-
You will be prompted to verify your configuration. Click Show Advanced Settings.
-
In the advanced settings, make sure you have the following settings for Memory and Storage:
-
Double-check that the RAM is at 4 GB or greater. The dropdown defaults to MB, so check that you switch it to GB or increase the memory accordingly before proceeding.
-
Set the Internal Storage to roughly twice the size of your game. For example, if your game is expected to be 2 GB in size, set this value to 4 GB.
-
-
Click Finish and the device will appear in the list of devices you can launch. You can click the Play button to start running your application. This may take a few minutes as the emulator loads up.
Set Up Required Android Features For Your Virtual Device
For your virtual device to fully support UE projects, you need to enable some graphics features for it:
-
Open the
Users/Username/.Androidfolder. -
Open
AndroidFeatures.ini.- If an
AndroidFeatures.inifile does not exist, create one.
- If an
-
Add the following variables:
-
Vulkan=on. -
GLDirectMem=on. This enables hardware GPU acceleration.
-
Run Your Android Virtual Device
You need to run your virtual device in the Android emulator to launch applications on your virtual device and attach debug processes to it. You can think of this as the emulator equivalent of turning your device on and hooking it up to your computer in developer mode. You can launch from Android Studio, or you can launch a standalone version of the emulator.
Launch From Android Studio
To launch your virtual device from Android Studio:
-
Open Android Studio, then click Tools > Device Manager.
-
In the Device Manager, click the Play button next to the device you want to launch.
The emulator will take a few minutes to load, but once it is loaded, you can control the virtual device with your mouse as you would a touchscreen.
Launch a Standalone Emulator From Your Desktop
You can launch it from Android Studio from the Device Manager, or you can follow these steps to launch a standalone version of the emulator:
-
Open the Android SDK root directory, then open the
Emulatorfolder. You should see an executable calledEmulator.exe. -
Use a command line to run this executable with the argument
-avd=[name of virtual device profile]. For example, if you named your profile Pixel8_UE, you would run with the argument-avd=Pixel8_UE.
The Android Emulator will display your virtual device on your desktop.
Launch Your UE Application On a Virtual Device
Once your Android Emulator is running, it will be visible to UE through the Device Manager and the Platforms dropdown in Unreal Editor.
See the Build Operations guide for more information.
While you specified a name for your virtual device's profile in Android Studio, this is not the same as the name of an instance of that virtual device. Double-check the device's name before providing the device name in command line arguments.
Debugging On a Virtual Device
As long as your Android virtual device is running, you can debug on it with Android Studio or Visual Studio using AGDE the same way you could with a physical device. However, to use the debugger, your Android app's architecture needs to match your PC's host architecture. For example:
-
If you are running on an x86_64 PC or an Intel mac, your app must be set to use the x86_64 architecture to debug on your desktop.
-
If you are using an Apple Silicon Mac or an arm64 Linux machine, your app must be set to use the arm64 architecture to debug on your desktop.
You can also take advantage of the following debugging and profiling resources:
-
Using Android File Server and Unreal Android File Tool for debugging and file management.
-
Running Traces with Unreal Insights.