Android模拟器有点迟钝。对于摩托罗拉Droid和Nexus One等设备,应用程序在实际设备上的运行速度比模拟器快。在测试游戏和视觉效果时,这是一个问题。
如何使模拟器尽可能快地运行?我一直在摆弄它的参数,但还没有发现一个配置显示出明显的改进。
Android模拟器有点迟钝。对于摩托罗拉Droid和Nexus One等设备,应用程序在实际设备上的运行速度比模拟器快。在测试游戏和视觉效果时,这是一个问题。
如何使模拟器尽可能快地运行?我一直在摆弄它的参数,但还没有发现一个配置显示出明显的改进。
当前回答
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.
其他回答
我一直在使用英特尔(86)CPU/ABI。我用ARM(armeabi-v7a)创建了另一个模拟器,我发现速度有了很大的提高。我使用的是平台4.1.2 API级别16
官方网页
~快50%
窗口:
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)
别忘了安装这个
备注:在AVD创建过程中添加模拟内存:硬件/新/设备ram大小/设置值512或更多
Linux:
安装KVM:打开谷歌,写“KVM installation” 用“Intel atom x86”CPU/ABI创建AVD 从命令行运行:emulator -avd avd_name -qemu -m 512 -enable-kvm 或者从Eclipse运行:运行/运行配置/标签“目标”- >检查Intel x86 AVD,并在“附加模拟器命令行选项”窗口添加:-qemu -m 512 -enable-kvm(单击运行)
附注:对于Fedora,对于Ubuntu
OS-X:
在“Android SDK管理器”中安装Intel x86 Atom System Image 在Android SDK管理器中,安装Intel x86 Emulator Accelerator (HAXM) 在finder中,转到Intel Emulator Accelerator的安装位置并安装IntelHAXM(打开dmg并运行安装)。您可以通过将鼠标放在SDK管理器中的Emulator Accelerator条目上来查找位置。 创建或更新AVD并指定Intel Atom x86作为CPU。
p.s.:检查这个工具,非常方便甚至试用
好吧,问题是从2011年开始的,我在2022年回答,根据我的经验,最好的答案是从命令启动模拟器,这样模拟器就会启动一个专用的进程,而不是android studio的子进程。如果进程是独立的,那么它将能够正确地使用GPU,并可以利用所有资源,不像从设备管理器启动模拟器。 你可以从设备管理器中创建AVD并从下面的AVD文件夹中独立启动模拟器。
如何打开模拟器命令行
更新:现在Intel x86映像已经可用,最好的答案是上面的zest。
正如CommonsWare正确指出的那样,这个模拟器很慢,因为它模拟的是ARM CPU,而ARM CPU需要转换成Intel操作码。这种虚拟化占用CPU资源。
为了让模拟器更快,你必须给它更多的CPU。从快速CPU开始,如果可以的话升级。
然后,给模拟器更多的CPU:
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).
我看到在这两个改变到位后,大约有50%的改善。
在Windows 7上设置处理器亲和性:
打开任务管理器 单击“查看所有进程”(以管理员身份运行,否则无法设置处理器相关性) 右键单击模拟器.exe并选择设置亲缘性… 在Set Affinity对话框中,只选择最后一个CPU
注意:当您以这种方式更改关联时,它只在流程的生命周期内更改。下一次开始,你必须再来一次。
启用GPU硬件加速(除了Intel的HAXM),如果你使用API 15 v3或更新版本和SDK Tools v17+。模拟器的图形加速利用开发计算机的图形硬件,特别是图形处理单元(GPU),使屏幕绘制速度更快。这大大提高了速度。
要在模拟器上启用默认启用的图形加速:在创建AVD时,在“硬件”部分单击“新建”,选择“GPU仿真”并将值设置为“是”。
要只在运行时启用加速:在启动模拟器时使用-gpu标志,如下所示:
emulator -avd <avd_name> -gpu on
来源:谷歌的使用模拟器教程。