You can use Android Emulator to create emulations of Android devices that run your own custom Android system images. You can also share your custom Android system images so that other people can run emulations of them. In addition, you can add multi-display support to Android Emulator emulations.
Android Emulator architecture
Android Emulator allows you to run emulations of Android devices on Windows, macOS or Linux machines. The Android Emulator runs the Android operating system in a virtual machine called an Android Virtual Device (AVD). The AVD contains the full Android software stack, and it runs as if it were on a physical device. Figure 1 is a diagram of the Android Emulator's high-level architecture. For more information about the emulator, see Run apps on the Android Emulator.
Figure 1. Android Emulator architecture
Building AVD images
Each AVD includes an Android system image, which runs in that AVD. The AVD Manager includes some system images. And you can build custom AVD system images from your source code and create device emulations to run them.
To build and run an AVD system image:
Download the Android source:
mkdir aosp-master; cd aosp-master
repo init -u
repo sync -j24
Build an AVD system image. This is the same process as building an Android device system image. For example, to build a x86 32-bit AVD:
mkdir aosp-master; cd aosp-master
If you prefer to build an x86 64-bit AVD, run
lunchfor the 64-bit target:
Run the AVD system image in the Android Emulator:
See the Command-line startup options for more details about running the emulator. Figure 2 shows an example of the Android Emulator running an AVD.
Figure 2. Android Emulator running an AVD
Sharing AVD system images for others to use with Android Studio
Follow these instructions to share your AVD system images with others. They can use your AVD system images with Android Studio to develop and test apps.
$ make -j32 sdk sdk_repo
This creates two files under
Host the file
sdk-repo-linux-system-images-eng.[username].zipsomewhere accessible to your users, and get its URL to use as the AVD System Image URL.
<sdk:url>to your AVD System Image URL.
- See sdk-sys-img-03.xsd to learn about other updates to the file.
repo-sys-img.xmlsomewhere accessible to your users, and get its URL to use as the Custom Update Site URL.
To use a custom AVD image, do the following in the SDK Manager:
This adds your custom AVD system image to the System Images page.
Create an AVD by downloading and selecting the custom AVD system image.
Adding Multi-Display support
Android 10 enhances Multi-Display (MD) to better support more use cases, such as auto and desktop mode. Android Emulator also supports multi-display emulation. So you can create a specific multi-display environment without setting up the real hardware.
You can add multi-display support to an AVD by making the following changes, or by cherry picking from these CLs.
Add multi-display provider to the build by adding these lines to file
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST := \ system/lib/libemulator_multidisplay_jni.so \ system/lib64/libemulator_multidisplay_jni.so \ system/priv-app/MultiDisplayProvider/MultiDisplayProvider.apk \ PRODUCT_PACKAGES += MultiDisplayProvider
Enable the Multi-Display feature flag by adding this line to file
MultiDisplay = on
You can find the latest emulator features and release information from the following sources: