Making the Android emulator run faster

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.


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 extrasintelHardware_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)
  • 在这里输入图像描述

    Also don't forget install this one

    在这里输入图像描述

    PS 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)
  • 在这里输入图像描述

    PS 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. 英特尔x86模拟器加速器(HAXM)显示位置
  • PS: Check this tool, very convenient even trial


    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:

  • 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.
  • 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:

  • Open Task Manager
  • Click View All Processes (to run as administrator, otherwise you can't set processor affinity)
  • Right click on emulator.exe and choose Set Affinity...
  • 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.

    在这里输入图像描述


    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仿真器以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.)

    链接地址: http://www.djcxy.com/p/90526.html

    上一篇: Android模拟器未启动

    下一篇: 让Android模拟器运行得更快