Android Studio 模拟器的选择和安装

一、Android Studio 自带的AVD模拟器

你是否遇到如下错误提示:

 

Android Studio 程序可以在真机上调试运行,Android Studio 也提供了模拟器来调试运行,这时需要配置 AVD 来选择你调试程序的模拟环境。
 1. 在 Intel CPU 的主机上启用 HAXM
在 Intel CPU 的主机上,为了加速AVD模拟器的运行速度,需要启用 HAXM 。如果在没有启用 HAXM 时就运行程序,调用AVD模拟器时会报如下错误:

emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!

出现此警告的原因是AVD模拟器调用X86架构的安卓虚拟机需要使用到Intel HAXM 引擎,而本机尚未进行安装导致。
此时,应该先进入 BIOS 启用 Virtualization Technology 选项。然后从 https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager/ 下载,也可以直接在 Android Studio 的 SDK 中下载,再安装即可。

2. 对于非 Intel CPU 的主机
对于非 Intel CPU 的主机或不能安装 HAXM 的主机(像我的云主机),则只能选择 arm 模拟器 或 选择其它第三方的模拟器 (像Genymotion)。
arm 模拟器的设置如下,不过一般情况下, arm 模拟器速度很慢 (像我的云主机启动它需要个吧小时),所以,应该尽量选用Genymotion等虚拟机。

3. 设置
如果以上配置无误,就可以运行程序试试。如果出现类似如下面的警告:
emulator: WARNING: Requested RAM size of 1536MB is too large for your environment, and is reduced to 1152MB.
emulator: device fd:596
HAXM is not working and emulator runs in emulation mode
emulator: The memory needed by this AVD exceeds the max specified in your HAXM configuration.
emulator: AVD RAM size = 1152 MB
emulator: HAXM max RAM size = 1024 MB
emulator: You might want to adjust your AVD RAM size and/or HAXM configuration to run in fast virt mode.
Cannot set up guest memory ‘pc.ram’: Invalid argument
警告提示模拟器RAM过大,需要在 AVD 中将模拟器的RAM改为512~1024,这样模拟器才能正常启动。

 

 

 

 

 

https://blog.csdn.net/qq_33505204/article/details/78452286?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2


关注公众号,了解更多it技术(it问答网

发表评论

电子邮件地址不会被公开。