让Android模拟器运行得更快

时间:2023-01-06 18:56:22

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.

Android模拟器有点迟缓。对于某些设备,比如摩托罗拉Droid和Nexus One,应用程序在实际设备中的运行速度比模拟器快。这是一个测试游戏和视觉效果的问题。

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.

如何使模拟器尽可能快地运行?我一直在研究它的参数,但还没有找到一个显示出明显改进的配置。

20 个解决方案

#1


214  

Official web page

官方网页

~50% faster

~快50%

Windows:

  • Install "Intel x86 Emulator Accelerator (HAXM)" => SDK-Manager/Extras
  • 安装“Intel x86仿真加速器(HAXM)”= >代码/临时演员
  • Install "Intel x86 Atom System Images" => SDK-Manager/Android 2.3.3
  • 安装“Intel x86 Atom系统映像”=> 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))

    转到Android SDK根文件夹并导航到附加的\Hardware_Accelerated_Execution_Manager。IntelHaxm执行文件。exe安装。(在Android Studio中可以导航到:设置-> Android SDK -> SDK工具-> Intel x86仿真加速器(HAXM安装程序))

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

    使用“Intel atom x86”CPU/ABI创建AVD

  • Run emulator and check in console that HAXM running (open a Command Prompt window and execute the command: sc query intelhaxm)
  • 运行模拟器并检查正在运行的控制台(打开命令提示窗口并执行命令:sc查询intelhaxm)

让Android模拟器运行得更快

Also don't forget install this one

也不要忘记安装这个

让Android模拟器运行得更快

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

在AVD创建过程中添加仿真内存:硬件/新的/设备ram大小/设置值512或更多

Linux:

  • Install KVM: open GOOGLE, write "kvm installation "
  • 安装KVM:打开谷歌,写“KVM安装”
  • Create AVD with "Intel atom x86" CPU/ABI
  • 使用“Intel atom x86”CPU/ABI创建AVD
  • Run from command line: emulator -avd avd_name -qemu -m 512 -enable-kvm
  • 从命令行运行:仿真器-avd avd_name -qemu - m512 -启用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)
  • 或者从Eclipse运行:运行/运行配置/选项卡“Target”—>检查Intel x86 AVD和“附加仿真器命令行选项”窗口添加:-qemu - m512 -启用kvm(单击run)

让Android模拟器运行得更快

P.S. For Fedora, for Ubuntu

Fedora的附注,Ubuntu的附注

OS-X:

  • In Android SDK Manager, install Intel x86 Atom System Image
  • 在Android SDK管理器中,安装Intel x86 Atom系统映像。
  • In Android SDK Manager, install Intel x86 Emulator Accelerator (HAXM)
  • 在Android SDK管理器中,安装Intel x86仿真器加速器(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.
  • 在finder中,进入Intel仿真器加速器的安装位置并安装IntelHAXM(打开dmg并运行安装)。您可以通过将鼠标放在SDK管理器中的仿真器加速器条目上找到位置。
  • Create or update an AVD and specify Intel Atom x86 as the CPU. 让Android模拟器运行得更快
  • 创建或更新AVD并指定Intel Atom x86为CPU。

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

P。店员:检查一下这个工具,即使试用也很方便

#2


34  

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

更新:现在已经有了一个Intel x86映像,最好的答案是上面的zest。

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.

正如CommonsWare所正确指出的,仿真器之所以很慢,是因为它模拟一个ARM CPU,这需要转换到Intel操作码。这种虚拟化咀嚼CPU。

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

为了使模拟器更快,你必须给它更多的CPU。如果可以的话,从一个快速的CPU或者升级开始。

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

然后,给模拟器更多的CPU:

  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. 禁用超线程—由于仿真器似乎没有使用多个内核,因此实际上,超线程减少了仿真器将获得的总体CPU时间。禁用HT将减慢利用多个cpu的应用程序。在BIOS中必须禁用超线程。
  3. 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).
  4. 让仿真器在CPU以外的CPU上运行——这比关闭HT有更小的影响,但它对一些有帮助。在Windows上,您可以指定进程将在哪个CPU上运行。许多应用程序将占用CPU 0,并且默认情况下模拟器在CPU 0上运行。我将模拟器更改为在最后一个模拟器上运行。注意,在OS X上不能设置亲和力(参见:https://superuser.com/questions/149312/how-to-set-processor- affin- on-a-mac)。

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

我看到这两个变化在某种程度上提高了50%。

To set processor affinity on Windows 7:

在Windows 7上设置处理器关联:

  1. Open Task Manager
  2. 打开任务管理器
  3. Click View All Processes (to run as administrator, otherwise you can't set processor affinity)
  4. 点击查看所有进程(以管理员身份运行,否则无法设置处理器关联)
  5. Right click on emulator.exe and choose Set Affinity...
  6. 右键单击模拟器。exe并选择Set Affinity…
  7. On the Set Affinity dialog, select just the last CPU
  8. 在Set Affinity对话框中,选择最后一个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.

注意:当你以这种方式改变亲和力时,它只会在整个过程中改变。接下来,你必须再做一次。

让Android模拟器运行得更快

#3


16  

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.

我想建议让Genymotion旋转一下。它在Oracle的VirtualBox中运行,在一个普通的系统上可以正常地达到60个fps。

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

这是我的一个工作室的屏幕截图,运行在低端的2012款MacBook Air上:

让Android模拟器运行得更快

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.

如果你看不清文本,它是一个运行在56.6 fps的Nexus 7模拟器。额外的(巨大的)好处是谷歌Play和谷歌Play服务与虚拟机打包在一起。

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

(演示动画的源代码可以在这里找到。)

#4


11  

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.

启用GPU硬件加速(除了Intel的HAXM),如果您正在使用API 15 v3或更新的和SDK工具v17+。仿真器的图形加速利用开发计算机的图形硬件,特别是图形处理单元(GPU),使屏幕绘图速度更快。这大大提高了速度。

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.

为了在模拟器上默认启用图形加速:在创建AVD时,在硬件部分,单击New,选择GPU模拟,并将值设置为Yes。

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

仅在运行时启用加速:在启动仿真器时使用-gpu标志,如下所示:

emulator -avd <avd_name> -gpu on

Source: Google's Using the Emulator tutorial.

来源:谷歌使用模拟器教程。

#5


9  

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

编辑虽然使用英特尔图像获得一些性能收益,但使用Genymotion获得的性能要大得多。看到保罗Lammertsma的回答。

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 rev17,仿真器支持在Windows和Mac OS x上以虚拟化模式运行x86系统映像,这对性能有显著影响。

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

ADT rev 17 notes: http://android-developers.blogspot.jp/2012/03/update -sdk- tooland -revision-17.html。

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

配置虚拟机加速:http://developer.android.com/guide/developing/devices/emulator.html#accel-vm

#6


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.

我最近将内核2 @ 2.5换成了i7 @ 1.73和8g ram(两个系统都运行Ubuntu 10.10),模拟器现在运行速度至少是它的两倍。向它扔更多的硬件当然有帮助。

#7


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!

我只是想说,在我安装了Intel HAXM加速器并使用了Intel Atom映像之后,仿真器的运行速度似乎快了50倍。差异是惊人的,看看吧!

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

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

#8


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.

我注意到模拟器只默认为Core 0,大多数Windows应用程序默认为“任意”核心。而且,如果你把它放在另一个核心上(比如最后一个核心),它可能会让模拟器发疯。如果可以,您可以尝试将大量CPU使用应用程序放在其他CPU内核上,以提高速度。

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.

从硬件的角度来说,获得最快的CPU,这适用于单核应用程序。在仿真器性能方面,超过2个内核可能不会有很大的不同。

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.

Eclipse + Android模拟器总共消耗了大量的RAM。我推荐3吉内存,至少因为我使用的系统有2吉内存,并且由于系统耗尽内存并开始使用页面文件而减慢了速度。

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.

我觉得最好的cpu可能会有一个高时钟(顺便说一句,只能用时钟作为cpu在同一系列中的度量),能够很好地处理非simd操作,并具有涡轮增压机制。目前没有很多基于java的基准测试,但总体上应该寻找压缩和office等应用程序基准。不要看游戏或媒体,因为它们受到SIMD的严重影响。如果你找到了Java,那就更好了。

#9


3  

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/O(2011),谷歌展示了一个更快的模拟器。问题不在于ARM和x86之间的字节代码,而在于QEMU执行的软件呈现。他们绕过QEMU的渲染,直接将渲染发送到X服务器。他们展示了一场表现很好的赛车游戏。

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

我想知道开发人员什么时候可以使用它……

#10


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.

谷歌最近发布了一个新的Android模拟器。它比旧的更快更好。你可以在这里找到更多的信息。

#11


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

我认为这是因为clr虚拟机直接使用cpu而没有代码操作码转换。它可能是对clr应用程序的优化,也可能是windows mobile/window phone 7在INTEL proccessor上启动。基于linux的Android平台,理论上可以在i686环境下的虚拟机上启动Android。在这种情况下,vmware等虚拟机可以直接执行一些操作码。但是只有在您编写Java时才允许使用此选项。因为Java在执行之前会解释它们的字节码或预编译它。参见:http://www.taranfx.com/how-to-run-google-android-in-virtualbox-vmware-on-netbooks

#12


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.

谢谢你@zest !工作就像一个魅力。需要注意的是:需要对HAXM应用英特尔的hotfix来处理内核恐慌问题:http://software.intel.com/en- us/android/articles/intel-hardwar-accelerator - execued -manager,注意,如果您有不止一个abi,您需要卸载其中一个,因为最新版本的Android API (r19)中有一个代码错误。id=66740(在本例中删除armeabi-v7a,因为需要x86 abi)。除了我花了45分钟来解决这些问题之外,对于提高模拟器性能来说,这是一个非常有益的练习。

#13


0  

Oh the asylum...the one run by the insane...woe is me...

哦,庇护……那个被疯子控制的……我有祸了……

There's a fairly comprehensive answer on my blog at http://tenacious33.wordpress.com/2012/04/05/improving-android-emulator-performance/

在我的博客http://tenacious33.wordpress.com/2012/04/05/iming -android-仿真器-性能/上有一个相当全面的答案

I'll address the r17 "accelerated mode" in my blog post in a week or two. The list of caveats associated with it doesn't inspire confidence or pride.

一两周后,我将在我的博客中介绍r17“加速模式”。与之相关的一系列警告并不能激发人们的信心或自豪感。

#14


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

我一直在使用Intel(86) CPU/ABI。我使用ARM(armeabi-v7a)创建了另一个模拟器,我发现速度有了很大的提高。我使用的是平台4.1.2 API级别16

#15


0  

An alternative to the emulator is the AndroVM virtual machine, which runs far faster than the emulator and supports OpenGL acceleration:

仿真器的替代品是AndroVM虚拟机,它比仿真器运行速度快得多,支持OpenGL加速:

http://androvm.org/

http://androvm.org/

Anecdotally, I feel that it runs faster than actual Android devices.

有趣的是,我觉得它比实际的Android设备运行得更快。

#16


0  

I hope this will help you.

我希望这能对你有所帮助。

Goto to your BIOS settings. Enable your Virtualization technology in your settings..

进入你的BIOS设置。在您的设置中启用虚拟化技术。

It solved my problem...

它解决了我的问题…

#17


0  

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

将当前的Android Studio更新为Android Studio 2.0,并更新系统镜像。

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.

Android Studio 2.0仿真器的运行速度比Android之前的仿真器快3倍,通过ADB增强,您现在可以将应用程序和数据推送到仿真器上的速度比物理设备快10倍。与物理设备一样,官方的Android模拟器也包含内置的谷歌Play服务,因此您可以测试更多的API功能。最后,新的仿真器拥有丰富的新特性来管理调用、电池、网络、GPS等等。

#18


0  

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.

你也可以尝试Visual Studio Android模拟器,它也可以作为一个独立的模拟器安装(你不需要Visual Studio)。请注意,它只能安装在Windows Pro或更高的系统上。

#19


0  

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

用Genymotion代替模拟器。Genymotion有更好的性能https://www.genymotion.com

#20


0  

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

如果你没有好的显卡(比如我),选择低分辨率的仿真器(比如:Nexus S)

#1


214  

Official web page

官方网页

~50% faster

~快50%

Windows:

  • Install "Intel x86 Emulator Accelerator (HAXM)" => SDK-Manager/Extras
  • 安装“Intel x86仿真加速器(HAXM)”= >代码/临时演员
  • Install "Intel x86 Atom System Images" => SDK-Manager/Android 2.3.3
  • 安装“Intel x86 Atom系统映像”=> 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))

    转到Android SDK根文件夹并导航到附加的\Hardware_Accelerated_Execution_Manager。IntelHaxm执行文件。exe安装。(在Android Studio中可以导航到:设置-> Android SDK -> SDK工具-> Intel x86仿真加速器(HAXM安装程序))

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

    使用“Intel atom x86”CPU/ABI创建AVD

  • Run emulator and check in console that HAXM running (open a Command Prompt window and execute the command: sc query intelhaxm)
  • 运行模拟器并检查正在运行的控制台(打开命令提示窗口并执行命令:sc查询intelhaxm)

让Android模拟器运行得更快

Also don't forget install this one

也不要忘记安装这个

让Android模拟器运行得更快

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

在AVD创建过程中添加仿真内存:硬件/新的/设备ram大小/设置值512或更多

Linux:

  • Install KVM: open GOOGLE, write "kvm installation "
  • 安装KVM:打开谷歌,写“KVM安装”
  • Create AVD with "Intel atom x86" CPU/ABI
  • 使用“Intel atom x86”CPU/ABI创建AVD
  • Run from command line: emulator -avd avd_name -qemu -m 512 -enable-kvm
  • 从命令行运行:仿真器-avd avd_name -qemu - m512 -启用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)
  • 或者从Eclipse运行:运行/运行配置/选项卡“Target”—>检查Intel x86 AVD和“附加仿真器命令行选项”窗口添加:-qemu - m512 -启用kvm(单击run)

让Android模拟器运行得更快

P.S. For Fedora, for Ubuntu

Fedora的附注,Ubuntu的附注

OS-X:

  • In Android SDK Manager, install Intel x86 Atom System Image
  • 在Android SDK管理器中,安装Intel x86 Atom系统映像。
  • In Android SDK Manager, install Intel x86 Emulator Accelerator (HAXM)
  • 在Android SDK管理器中,安装Intel x86仿真器加速器(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.
  • 在finder中,进入Intel仿真器加速器的安装位置并安装IntelHAXM(打开dmg并运行安装)。您可以通过将鼠标放在SDK管理器中的仿真器加速器条目上找到位置。
  • Create or update an AVD and specify Intel Atom x86 as the CPU. 让Android模拟器运行得更快
  • 创建或更新AVD并指定Intel Atom x86为CPU。

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

P。店员:检查一下这个工具,即使试用也很方便

#2


34  

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

更新:现在已经有了一个Intel x86映像,最好的答案是上面的zest。

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.

正如CommonsWare所正确指出的,仿真器之所以很慢,是因为它模拟一个ARM CPU,这需要转换到Intel操作码。这种虚拟化咀嚼CPU。

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

为了使模拟器更快,你必须给它更多的CPU。如果可以的话,从一个快速的CPU或者升级开始。

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

然后,给模拟器更多的CPU:

  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. 禁用超线程—由于仿真器似乎没有使用多个内核,因此实际上,超线程减少了仿真器将获得的总体CPU时间。禁用HT将减慢利用多个cpu的应用程序。在BIOS中必须禁用超线程。
  3. 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).
  4. 让仿真器在CPU以外的CPU上运行——这比关闭HT有更小的影响,但它对一些有帮助。在Windows上,您可以指定进程将在哪个CPU上运行。许多应用程序将占用CPU 0,并且默认情况下模拟器在CPU 0上运行。我将模拟器更改为在最后一个模拟器上运行。注意,在OS X上不能设置亲和力(参见:https://superuser.com/questions/149312/how-to-set-processor- affin- on-a-mac)。

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

我看到这两个变化在某种程度上提高了50%。

To set processor affinity on Windows 7:

在Windows 7上设置处理器关联:

  1. Open Task Manager
  2. 打开任务管理器
  3. Click View All Processes (to run as administrator, otherwise you can't set processor affinity)
  4. 点击查看所有进程(以管理员身份运行,否则无法设置处理器关联)
  5. Right click on emulator.exe and choose Set Affinity...
  6. 右键单击模拟器。exe并选择Set Affinity…
  7. On the Set Affinity dialog, select just the last CPU
  8. 在Set Affinity对话框中,选择最后一个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.

注意:当你以这种方式改变亲和力时,它只会在整个过程中改变。接下来,你必须再做一次。

让Android模拟器运行得更快

#3


16  

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.

我想建议让Genymotion旋转一下。它在Oracle的VirtualBox中运行,在一个普通的系统上可以正常地达到60个fps。

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

这是我的一个工作室的屏幕截图,运行在低端的2012款MacBook Air上:

让Android模拟器运行得更快

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.

如果你看不清文本,它是一个运行在56.6 fps的Nexus 7模拟器。额外的(巨大的)好处是谷歌Play和谷歌Play服务与虚拟机打包在一起。

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

(演示动画的源代码可以在这里找到。)

#4


11  

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.

启用GPU硬件加速(除了Intel的HAXM),如果您正在使用API 15 v3或更新的和SDK工具v17+。仿真器的图形加速利用开发计算机的图形硬件,特别是图形处理单元(GPU),使屏幕绘图速度更快。这大大提高了速度。

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.

为了在模拟器上默认启用图形加速:在创建AVD时,在硬件部分,单击New,选择GPU模拟,并将值设置为Yes。

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

仅在运行时启用加速:在启动仿真器时使用-gpu标志,如下所示:

emulator -avd <avd_name> -gpu on

Source: Google's Using the Emulator tutorial.

来源:谷歌使用模拟器教程。

#5


9  

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

编辑虽然使用英特尔图像获得一些性能收益,但使用Genymotion获得的性能要大得多。看到保罗Lammertsma的回答。

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 rev17,仿真器支持在Windows和Mac OS x上以虚拟化模式运行x86系统映像,这对性能有显著影响。

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

ADT rev 17 notes: http://android-developers.blogspot.jp/2012/03/update -sdk- tooland -revision-17.html。

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

配置虚拟机加速:http://developer.android.com/guide/developing/devices/emulator.html#accel-vm

#6


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.

我最近将内核2 @ 2.5换成了i7 @ 1.73和8g ram(两个系统都运行Ubuntu 10.10),模拟器现在运行速度至少是它的两倍。向它扔更多的硬件当然有帮助。

#7


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!

我只是想说,在我安装了Intel HAXM加速器并使用了Intel Atom映像之后,仿真器的运行速度似乎快了50倍。差异是惊人的,看看吧!

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

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

#8


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.

我注意到模拟器只默认为Core 0,大多数Windows应用程序默认为“任意”核心。而且,如果你把它放在另一个核心上(比如最后一个核心),它可能会让模拟器发疯。如果可以,您可以尝试将大量CPU使用应用程序放在其他CPU内核上,以提高速度。

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.

从硬件的角度来说,获得最快的CPU,这适用于单核应用程序。在仿真器性能方面,超过2个内核可能不会有很大的不同。

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.

Eclipse + Android模拟器总共消耗了大量的RAM。我推荐3吉内存,至少因为我使用的系统有2吉内存,并且由于系统耗尽内存并开始使用页面文件而减慢了速度。

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.

我觉得最好的cpu可能会有一个高时钟(顺便说一句,只能用时钟作为cpu在同一系列中的度量),能够很好地处理非simd操作,并具有涡轮增压机制。目前没有很多基于java的基准测试,但总体上应该寻找压缩和office等应用程序基准。不要看游戏或媒体,因为它们受到SIMD的严重影响。如果你找到了Java,那就更好了。

#9


3  

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/O(2011),谷歌展示了一个更快的模拟器。问题不在于ARM和x86之间的字节代码,而在于QEMU执行的软件呈现。他们绕过QEMU的渲染,直接将渲染发送到X服务器。他们展示了一场表现很好的赛车游戏。

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

我想知道开发人员什么时候可以使用它……

#10


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.

谷歌最近发布了一个新的Android模拟器。它比旧的更快更好。你可以在这里找到更多的信息。

#11


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

我认为这是因为clr虚拟机直接使用cpu而没有代码操作码转换。它可能是对clr应用程序的优化,也可能是windows mobile/window phone 7在INTEL proccessor上启动。基于linux的Android平台,理论上可以在i686环境下的虚拟机上启动Android。在这种情况下,vmware等虚拟机可以直接执行一些操作码。但是只有在您编写Java时才允许使用此选项。因为Java在执行之前会解释它们的字节码或预编译它。参见:http://www.taranfx.com/how-to-run-google-android-in-virtualbox-vmware-on-netbooks

#12


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.

谢谢你@zest !工作就像一个魅力。需要注意的是:需要对HAXM应用英特尔的hotfix来处理内核恐慌问题:http://software.intel.com/en- us/android/articles/intel-hardwar-accelerator - execued -manager,注意,如果您有不止一个abi,您需要卸载其中一个,因为最新版本的Android API (r19)中有一个代码错误。id=66740(在本例中删除armeabi-v7a,因为需要x86 abi)。除了我花了45分钟来解决这些问题之外,对于提高模拟器性能来说,这是一个非常有益的练习。

#13


0  

Oh the asylum...the one run by the insane...woe is me...

哦,庇护……那个被疯子控制的……我有祸了……

There's a fairly comprehensive answer on my blog at http://tenacious33.wordpress.com/2012/04/05/improving-android-emulator-performance/

在我的博客http://tenacious33.wordpress.com/2012/04/05/iming -android-仿真器-性能/上有一个相当全面的答案

I'll address the r17 "accelerated mode" in my blog post in a week or two. The list of caveats associated with it doesn't inspire confidence or pride.

一两周后,我将在我的博客中介绍r17“加速模式”。与之相关的一系列警告并不能激发人们的信心或自豪感。

#14


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

我一直在使用Intel(86) CPU/ABI。我使用ARM(armeabi-v7a)创建了另一个模拟器,我发现速度有了很大的提高。我使用的是平台4.1.2 API级别16

#15


0  

An alternative to the emulator is the AndroVM virtual machine, which runs far faster than the emulator and supports OpenGL acceleration:

仿真器的替代品是AndroVM虚拟机,它比仿真器运行速度快得多,支持OpenGL加速:

http://androvm.org/

http://androvm.org/

Anecdotally, I feel that it runs faster than actual Android devices.

有趣的是,我觉得它比实际的Android设备运行得更快。

#16


0  

I hope this will help you.

我希望这能对你有所帮助。

Goto to your BIOS settings. Enable your Virtualization technology in your settings..

进入你的BIOS设置。在您的设置中启用虚拟化技术。

It solved my problem...

它解决了我的问题…

#17


0  

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

将当前的Android Studio更新为Android Studio 2.0,并更新系统镜像。

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.

Android Studio 2.0仿真器的运行速度比Android之前的仿真器快3倍,通过ADB增强,您现在可以将应用程序和数据推送到仿真器上的速度比物理设备快10倍。与物理设备一样,官方的Android模拟器也包含内置的谷歌Play服务,因此您可以测试更多的API功能。最后,新的仿真器拥有丰富的新特性来管理调用、电池、网络、GPS等等。

#18


0  

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.

你也可以尝试Visual Studio Android模拟器,它也可以作为一个独立的模拟器安装(你不需要Visual Studio)。请注意,它只能安装在Windows Pro或更高的系统上。

#19


0  

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

用Genymotion代替模拟器。Genymotion有更好的性能https://www.genymotion.com

#20


0  

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

如果你没有好的显卡(比如我),选择低分辨率的仿真器(比如:Nexus S)