262

The Android emulator is a bit sluggish. For some devices, like the Motorola Droid and the Nexus One, the app runs faster in the actual device than the emulator. This is a problem when testing games and visual effects.

How do you make the emulator run as fast as possible? I've been toying with its parameters but haven't found a configuration that shows a noticeable improvement yet.

hpique
  • 119,096
  • 131
  • 338
  • 476
  • 1
    all my apps run faster on the device –  Apr 18 '10 at 15:07
  • 19
    It's funny because the iPhone simulator is exactly the opposite. The apps run slower on the device. In most cases I prefer a slower emulator, because it stimulates you to improve your app, but sometimes you just want to see it work like it does in a real device. – hpique Apr 18 '10 at 15:14
  • 1
    It's possible to make it run MUCH faster aka normally by using VirtualBox - see http://stackoverflow.com/a/6058689/40961 – David d C e Freitas Feb 04 '12 at 08:43
  • Possible duplicate of [Slow Android emulator](http://stackoverflow.com/questions/1554099/slow-android-emulator). – blahdiblah Mar 13 '12 at 03:50
  • check out this guide from INTEL to set up emulators using intel haxm http://software.intel.com/en-us/articles/speeding-up-the-android-emulator-on-intel-architecture – Maulik Sheth Oct 29 '13 at 10:45
  • http://software.intel.com/en-us/articles/speeding-up-the-android-emulator-on-intel-architecture – Abhishek Bedi Dec 18 '13 at 10:11
  • 5
    iOS and Windows Mobile use Simulators, whereas Android uses Emulators. Simulators re-implement all mobile libraries and APIs using host libraries, and thus are fast. Emulators use the same libraries as on the real devices, so it's slower. In terms of Android, if you use an Android virtual machine, it will be very fast. We provide a free vm here: http://www.leapdroid.com – huisinro Jun 23 '16 at 21:46
  • @hpique - That may be a flawed rationale. At the very least, the bottlenecks within the emulator are likely to be distributed differently than the bottlenecks on an actual device, and optimizations that improve performance on one may have no effect (or even, a detrimental effect) on the other. I just want the emulator as a way to quickly verify that I've got my look/feel/flow correct, and that the app doesn't crash and burn when I invoke . Performance testing and optimization is something I'll always do using an actual device. – aroth Jul 28 '16 at 14:04
  • 3
    ...and how crazy is it that 6 years later, and even with HAXM and the x86 system image and a well-specced dev environment the Android emulator is still slow as molasses? – aroth Jul 28 '16 at 14:05
  • enable quick boot to make emulator fast check https://stackoverflow.com/a/48031415/2826147 – Amit Vaghela Dec 30 '17 at 05:58

19 Answers19

238

Official web page

~50% faster

Windows:

  • Install "Intel x86 Emulator Accelerator (HAXM)" => SDK-Manager/Extras
  • Install "Intel x86 Atom System Images" => SDK-Manager/Android 2.3.3
  • Go to the Android SDK root folder and navigate to extras\intel\Hardware_Accelerated_Execution_Manager. Execute file IntelHaxm.exe to install. (in Android Studio you can navigate to: Settings -> Android SDK -> SDK Tools -> Intel x86 Emulator Accelerator (HAXM installer))

  • Create AVD with "Intel atom x86" CPU/ABI

  • Run emulator and check in console that HAXM running (open a Command Prompt window and execute the command: sc query intelhaxm)

enter image description here

Also don't forget install this one

enter image description here

P.S. during AVD creation add emulation memory: Hardware/New/Device ram size/set up value 512 or more

Linux:

  • Install KVM: open GOOGLE, write "kvm installation "
  • Create AVD with "Intel atom x86" CPU/ABI
  • Run from command line: emulator -avd avd_name -qemu -m 512 -enable-kvm
  • Or run from Eclipse: Run/Run Configurations/Tab "Target" - > check Intel x86 AVD and in "Additional Emulator Command Line Options" window add: -qemu -m 512 -enable-kvm (click Run)

enter image description here

P.S. For Fedora, for Ubuntu

OS-X:

  • In Android SDK Manager, install Intel x86 Atom System Image
  • In Android SDK Manager, install Intel x86 Emulator Accelerator (HAXM)
  • In finder, go to the install location of the Intel Emulator Accelerator and install IntelHAXM (open the dmg and run the installation). You can find the location by placing your mouse over the Emulator Accelerator entry in the SDK Manager.
  • Create or update an AVD and specify Intel Atom x86 as the CPU. Intel x86 Emulator Accelerator (HAXM) showing Location

P.S: Check this tool, very convenient even trial

Ibrahim.H
  • 1,062
  • 1
  • 13
  • 22
Henadzi Rabkin
  • 6,834
  • 3
  • 32
  • 39
  • 8
    This works in OSX as well. You need to install `/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg` after you download the package from the SDK manager. – Jarett Millard May 08 '13 at 15:57
  • 6
    The Windows instructions with **"Use Host GPU"** gave me a super-fast emulator! (I have a supported Intel processor and an nVidia graphics card.) The animations are **buttery smooth** (_most of the time_; at other times, very little jerkiness)! Note that you have to **restart Eclipse** for the AVD Manager to pick up the _Intel Atom (x86)_ CPU option. **Tip:** Don't allocate too much RAM. With 1GB RAM, emulator failed to start (with GPU) but with 512MB RAM it ran smoothly and booted really quickly (again with GPU). – ADTC Jul 28 '13 at 16:11
  • I found that the LogCat gets spammed with a lot of Trace warnings. To filter them out, use `^(?!.*(nativeGetEnabledTags)).*$` as the text filter. I have reported this as a [bug issue](https://code.google.com/p/android/issues/detail?id=58155). Also, I think you have to properly shut down your emulator device (hold the power button, then select _Power off_) to avoid having errors when you start it the next time (I could just close the ARM emulator, but with the Intel emulator, _just closing_ seems to create problems). – ADTC Jul 28 '13 at 17:11
  • I'd give you +100 if I could. Works on Windows 8 and performances increased terrificly! – Paolo M Aug 07 '13 at 15:28
  • 2
    I had to disable Hyper V technology first through program and features under the control panel to get this to work. – Mike Flynn Jan 04 '14 at 00:03
  • WOW! This is very very fast. – malhobayyeb Feb 07 '14 at 23:43
  • @ADTC the same applied for me on OSX, once I used **Use Host GPU** and **512MB** ram my emulator ran great. Anything above 512MB ram and it would fail to start. – ferics2 Mar 26 '14 at 13:51
  • this computer does not support intel virtulization technology. can't istall what to do? – Prasad Dec 07 '15 at 10:52
  • I got this error `PANIC: Missing emulator engine program for 'x86' CPU.` when run `emulator -avd Pixel_2_API_29 -qemu -m 512 -enable-kvm ` – U.A Mar 25 '20 at 15:06
  • my system has AMD Rayzen, can this run Intel XAHM ? – rashidnk Aug 03 '20 at 05:55
  • @rashidnk No, use "Android Emulator Hypervisor Driver for AMD Processors" – Henadzi Rabkin Aug 06 '20 at 14:05
36

UPDATE: Now that an Intel x86 image is available, the best answer is by zest above.

As CommonsWare has correctly pointed out, the emulator is slow because it emulates an ARM CPU, which requires translation to Intel opcodes. This virtualization chews up CPU.

To make the emulator faster, you have to give it more CPU. Start with a fast CPU or upgrade if you can.

Then, give the emulator more of the CPU you have:

  1. Disable Hyperthreading - Since the emulator doesn't appear to utilize more than one core, hyperthreading actually reduces the amount of overall CPU time the emulator will get. Disabling HT will slow down apps that take advantage of multiple CPUs. Hyperthreading must be disabled in your BIOS.
  2. Make the emulator run on a CPU other than CPU 0 - This has a much smaller impact than turning off HT, but it helps some. On Windows, you can specify which CPU a process will run on. Many apps will chew up CPU 0, and by default the emulator runs on CPU 0. I change the emulator to run on the last one. Note that on OS X you cannot set affinity (see: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-a-mac).

I'm seeing somewhere around a 50% improvement with these two changes in place.

To set processor affinity on Windows 7:

  1. Open Task Manager
  2. Click View All Processes (to run as administrator, otherwise you can't set processor affinity)
  3. Right click on emulator.exe and choose Set Affinity...
  4. On the Set Affinity dialog, select just the last CPU

Note: When you change affinity in this way, it's only changed for the lifetime of the process. Next start, you have to do it again.

enter image description here

Community
  • 1
  • 1
mcohen75
  • 690
  • 1
  • 8
  • 16
  • 23
    The CPU percentage doubled when you disabled hyper-threading because you halved the amount of logical processors. – Timothy003 Jul 06 '11 at 08:02
  • 1
    It works like charm but.. Do you know how to do it on Ubuntu 11.10? – emeraldhieu Nov 30 '11 at 07:51
  • 1
    @Timothy003 yes absolutely correct. And doubled the CPU the emulator will use. – mcohen75 Mar 30 '12 at 17:27
  • 3
    You only see a doubling in the number task manager shows; not in reality. If you're not running enough software to generate enough work to have the equivalent of at least 4 threads at 100% CPU the the few apps doing heavy CPU usage will still effectively get almost the entire core, not the half core your naive assumption of what task manager is displaying means. – Dan Is Fiddling By Firelight Jul 27 '12 at 13:24
  • 3
    To confirm what @Dan Neely says: I have a single core app, that just burns 100% cpu. When I have HT it shows about 25%, without it shows about 50%, but in fact in computes what it has to compute in the same time. So no difference (at least on Sandy Bridge). – bartosz.r Sep 13 '12 at 22:57
  • Yes, no difference (or if there is some difference, it is minimal). @ cores + HT = 4 logical cores. Each one can make at most 25% usage. The other case: 2 cores without HT = 2 logical cores. Each one can make at most 50% usage. I have 4 cores + HT = 8 logical cores. Each core can make at most 12.5% usage. But this 12.5% = 25% = 50% in terms of performance for your app in case the cores have the same architecture and frequency. – Stan Dec 10 '12 at 15:59
  • Perfect! I can now have multiple AVDs running simultaneously, each on a separate CPU! – Elist Aug 18 '13 at 10:21
17

I would like to suggest giving Genymotion a spin. It runs in Oracle's VirtualBox, and will legitimately hit 60 fps on a moderate system.

Here's a screencap from one of my workshops, running on a low-end 2012 model MacBook Air:

Nexus 7 emulator running at 56.6 fps

If you can't read the text, it's a Nexus 7 emulator running at 56.6 fps. The additional (big!) bonus is that Google Play and Google Play Services come packaged with the virtual machines.

(The source of the demoed animation can be found here.)

Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
14

Enable GPU Hardware Acceleration (in addition to Intel's HAXM), if you are using API 15 v3 or newer and SDK Tools v17+. Graphics acceleration for the emulator takes advantage of your development computer's graphics hardware, specifically its graphics processing unit (GPU), to make screen drawing faster. This gives a noticeable boost in speed.

To enable graphics acceleration enabled by default on your emulator: when creating the AVD, in the Hardware section, click New, select GPU emulation and set the value to Yes.

To enable acceleration only at runtime: use the -gpu flag while starting the emulator like this:

emulator -avd <avd_name> -gpu on

Source: Google's Using the Emulator tutorial.

John Lehmann
  • 7,975
  • 4
  • 58
  • 71
10

Edit Although using the Intel images gets some performance gains, the performance gained by using Genymotion is much greater. See Paul Lammertsma's answer.

Previous Answer

With ADT rev 17 the emulator supports running x86 system images in virtualization mode on Windows and Mac OS X. This has a noticeable impact on performance.

ADT rev 17 notes: http://android-developers.blogspot.jp/2012/03/updated-sdk-tools-and-adt-revision-17.html

Configuring Virtual Machine Acceleration: http://developer.android.com/guide/developing/devices/emulator.html#accel-vm

Community
  • 1
  • 1
ThomasW
  • 16,981
  • 4
  • 79
  • 106
7

I recently switched from a core 2 @ 2.5 with 3gb of ram to an i7 @ 1.73 with 8gb ram (both systems ran Ubuntu 10.10) and the emulator runs at least twice as fast now. Throwing more hardware at it certainly does help.

TripleG
  • 87
  • 1
  • 1
  • This is not really a solution: it may make the emulator have a higher throughput per time, but it won't actually make it run any faster. – Clearer Dec 02 '14 at 16:37
6

Just wanted to say that after I installed the Intel HAXM accelerator and use the Intel Atom image the emulator seems to run 50 times faster. The difference is amazing, check it out!

http://www.developer.com/ws/android/development-tools/haxm-speeds-up-the-android-emulator.html

sonicboom
  • 4,928
  • 10
  • 42
  • 60
4

I noticed that the emulator defaults to only Core 0, where most Windows applications will default to "any" core. Also, if you put it on another core (like the last core), it may make the emulator go crazy. If you can, you can try putting your heavy-CPU usage applications on the other CPU cores for a boost in speed.

Hardware-wise, get the fastest CPU you can get that works for single-core applications. More than 2 cores might not experience a huge difference in terms of emulator performance.

Eclipse + the Android emulator together eat up a ton of RAM. I would recommend 3 gigs of RAM at least because I used a system with 2 gigs of RAM, and it slowed down because the system ran out of RAM and started to use the page file.

I feel that the best CPUs for it will probably have a high clock (only use clock as a measure for CPUs in the same series btw), handle non-SIMD operations well, and have a turbo boost mechanism. There aren't many Java-based benchmarks, but overall look for application benchmarks like compression and office. Don't look at gaming or media since those are affected greatly by SIMD. If you find a Java one, even better.

Joe P
  • 41
  • 1
4

On this year google I/O (2011), Google demonstrated a faster emulator. The problem is not so much on the byte code between ARM and x86 but the software rendering performed by QEMU. They bypass the rendering of QEMU and send the rendering directly to an X server I believe. They showed a car game with really good performace and fps.

I wonder when that will be available for developers...

Cesar
  • 81
  • 2
3

Google recently announced a new emulator for Android. It's a much faster and better than the old one. You can find more info about it here.

Koc
  • 232
  • 2
  • 12
2

choose a low resolution emulator (eg: Nexus S) if you don't have a good graphic card (like me)

Dan Alboteanu
  • 9,404
  • 1
  • 52
  • 40
1

Thank you @zest! Worked like a charm. Some things of note: Need to apply Intel's hotfix for the HAXM to deal with kernel panic issue: http://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager Also, note, if you have more than one abi, you need to uninstall one due to a bug in the latest version of the Android API (r19): https://code.google.com/p/android/issues/detail?id=66740 (remove armeabi-v7a in this case, since you want the x86 abi). Other than the 45-minutes it took me to resolve these, it was an very rewarding exercise in terms of the increased performance of the emulator.

horcle_buzz
  • 2,101
  • 3
  • 30
  • 59
1

You could also try the Visual Studio Android Emulator, which can also be installed as a standalone emulator (you don't need Visual Studio). Please note, that it can be installed only on Windows Pro or higher systems.

David Dostal
  • 711
  • 13
  • 17
1

Use Genymotion instead of emulator. Genymotion has better performance https://www.genymotion.com

Prilaga
  • 818
  • 10
  • 18
1

I think it is because clr virtual machine uses cpu directly without code opcode translation. It may be optimization for clr application or may be windows mobile/window phone 7 started on INTEL proccessor. Android platform based on linux and theoretically you can start android on virtual machine in i686 environment. In this case virtual machines such as vmware could execute some opcodes direcly. But this option will be allowed only if you write on the Java. Because the Java interpret their byte-code or precompile it before execution. see: http://www.taranfx.com/how-to-run-google-android-in-virtualbox-vmware-on-netbooks

assad
  • 11
  • 1
1

Enabling this option worked for me.

AVD Manager -> Select device and click Edit-> Enable the option 'Use Host GPU'

enter image description here

anandhu
  • 686
  • 2
  • 13
  • 40
0

I've been using the Intel(86) CPU/ABI. I created another emulator using the ARM(armeabi-v7a) and i found quite an improvement with the speed. I'm using platform 4.1.2 API level 16

strange_developer
  • 1,327
  • 2
  • 12
  • 17
0

Update your current Android Studio to Android Studio 2.0 And also update system images.

Android Studio 2.0 emulator runs ~3x faster than Android’s previous emulator, and with ADB enhancements you can now push apps and data 10x faster to the emulator than to a physical device. Like a physical device, the official Android emulator also includes Google Play Services built-in, so you can test out more API functionality. Finally, the new emulator has rich new features to manage calls, battery, network, GPS, and more.

Umer
  • 1,566
  • 2
  • 20
  • 31
0

Well question is from 2011 and I am answering in 2022 the best answer in my experience is to start emulator from command in that way the emulator starts a dedicated process and not a sub process of android studio. If the process is independent then it will be able to use the GPU properly and can utilize all resources unlike starting emulator from device manager. You can create AVD from device manager and start is from the avd folder below is the way to start the emulator independently.

How to open emulator command line