Setting up the Android Emulator for speed

Making the Android Emulator fast!

The Android Emulator has come a long way and is now faster than ever… as long as you have it configured correctly. We make it easy by providing optimized defaults and recommended settings during the setup wizard, but you might want to double check you have the correct settings if you had created your AVDs in the past.

VM acceleration

HAXM installation is required on Windows / Mac

First, make sure you have the correct virtualization layer installed on your OS. As part of the Android Studio installation we provide Intel HAXM software on Windows and Mac. Please note that you’ll need an Intel CPU with Virtualization Technology enabled in your computer’s BIOS settings to make use of HAXM, as the HAXM software is not compatible with AMD processors.

On Linux, you should use the KVM package (it supports both Intel and AMD processors). Your CPU needs to support virtualization extensions (Intel VT-x or AMD-V) and you need to have those enabled in your computer’s settings.

For more detailed instructions on how to install and verify that HAXM and KVM are enabled correctly, please refer to our new documentation pages (scroll down to find instructions for your operating system). For BIOS instructions, please look up your laptop or motherboard instruction manual.

Choosing a device definition

If you accepted all the defaults during the installation of Android Studio, you should see an AVD already on the list of available devices that is configured for the optimal settings.

Android Virtual Device Manager with list of created AVDs

For this tutorial, we are making a new AVD to help explain how to setup additional AVDs. Start by clicking on the “Create Virtual Device” button in the Android Virtual Device Manager.

Step 1 of creating an AVD

Here you have the choice of some reference Android device screen sizes and densities, such as those used on Nexus phones and tablets. If you’re not using a high-end machine with a fast GPU for development, you can make your emulator a bit smoother by selecting one of the presets with a lower screen resolution.

You don’t necessarily need to emulate a 1080 x 1920 device for development, it’s usually perfectly fine to use a 480 x 800 hdpi emulator for quick iteration. Remember that you can always change the resolution and screen size later by editing the AVD in the Virtual Device Manager and choosing a different device definition.

Choosing the right system image

There are three pieces of advice that are important when choosing a system image for your AVD.

Step 2: choosing a system image

First, choose one of the recent dessert releases (API levels), as those typically run fastest and contain the newest fixes and optimizations for the emulator environment.

Second, make sure you choose an x86 image as emulating these is faster on an x86 machine that you’re most certainly using for development.

Finally, you will normally want to select a system image marked as “(with Google APIs)”, which means it contains Google Play Services and some core apps (such as Google Maps) built-in to help with testing your integrations.

The UI in this step is built to support those choices — the Recommended tab shows the newest API levels with x86 images and Google APIs, while the second tab shows all x86 images. If you need to emulate an older Android release or test your app on ARM binaries, you can check out the “Other images” tab.

GPU acceleration

The last step is making sure GPU acceleration works. Ideally, with modern graphics cards and up-to-date drivers you shouldn’t need to do anything to enable it. There’s a setting on the last AVD creation step that’s by default set to detect the GPU capabilities automatically and enable the correct acceleration level.

Step 3: verify settings and finish.

If you’re having problems, the first thing to do would be make sure your graphics card drivers are up to date. You can also read more about the command line switches for various emulation modes, such as choosing between different hardware and software renderers.

Advanced settings: amount of RAM and number of CPUs

If you want to try your hand at fine tuning some more parameters, you can experiment with assigning more (or less, depending on your development machine’s capabilities) CPU cores and RAM to the emulated device. Android Studio will try to choose sane defaults when creating devices, but your results may vary. You can also choose to emulate a larger SD card if you need more space for storage.

If you encounter bugs with the emulator and the setup process, please read the Android Studio bug filing process and use the Android issue tracker to let us know about any problems.

Show your support

Clapping shows how much you appreciated Wojtek Kaliciński’s story.