关于Android Studio运行出现HAX is not working 的解决办法

来源:互联网 发布:像程序员一样思考pdf 编辑:程序博客网 时间:2024/05/17 08:38

摘要: 本文解决了Android Studio 1.2.2下运行期间出现的HAX is not working and emulator runs in emulation mode问题。

问题描述:

在Windows环境下Android Studio运行时,出现下面错误信息:

    HAX 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 = 1536 MB    emulator: HAXM max RAM size = 512 MB    emulator: You might want to adjust your AVD RAM size and/or HAXM configuration to run in fast virt mode.    

在Android Studio初次运行过程中,已经创建好了Android虚拟设备Nexus_5_API_22_x86, 但这个虚拟设备现在运行时出现了手机界面,但是其中什么也没有显示出来。

问题解决:

什么是HAXM呢?它是Intel Hardware Accelerated Execution Manager (Intel® HAXM) 缩写,是Intel为了在开发主机上模拟Android app运行,使用虚拟化技术推出的一种利用硬件来辅助虚拟化的引擎。

在Android Studio安装过程中, HAXM缺省设置占用的内存为512MB。由于Nexus 5 AVD占用内存设置为1536MB,超过了HAXM的内存,因此模拟器无法正常运行。即AVD占用内存不能高于HAXM分配内存。 但是改变HAXM内存只能重装,所以我们需要重新安装HAMX。

通过Android SDK Manager下载HAXM

在 Android Studio 1.4中 Default Setting 中
下载HAMX

弹出提示框点击OK就好。

下载HAMX

至此,这里只是HAXM包下载到了 (Android SDK)/extras/intel 目录下,还需要手动来安装。

Android SDK路径在这里:
Android SDK路径

HAXM包在这里:
HAXM包

手动安装HAMX

双击 intelhaxm-android.exe 运行安装程序

这里写图片描述
点击 Next (下一步)

这里写图片描述
因为在安装Android Studio是安装过HAMX,所以这里需要选择 Change (更改)

这里写图片描述
根据电脑配置不同,默认值不同,推荐使用默认值。也可根据情况手动设置。设置好之后点击 Next (下一步)

会有提示,点击Change (更改)

这里写图片描述
点击Finish安装完毕。

如果要再次修改Intel HAXM内存,需要重新运行HAXM Installer,更改内存大小即可。

再次运行原来的程序,可看出HAX正常运行:

ulator: device fd:17596HAX is working and emulator runs in fast virt modeemulator: warning: opening audio input failedcreating window 61 83 462 820emulator: emulator window was out of view and was recentered

应用程序已经运行在模拟器上,至此问题解决。

最后再说几句

参考

AS问题解决系列4—HAX is not working

相关

[1] Windows环境下Android Studio V1.2.2系列1—下载与安装
http://my.oschina.net/1pei/blog/467210

[2] Windows环境下Android Studio V1.2.2系列2—初次运行
http://my.oschina.net/1pei/blog/467736

[3] Intel® Hardware Accelerated Execution Manager
https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager

[4] How to fix: “HAX is not working and emulator runs in emulation mode
http://stackoverflow.com/questions/21031903/how-to-fix-hax-is-not-working-and-emulator-runs-in-emulation-mode

[5] Installation Instructions for Intel® Hardware Accelerated Execution Manager - Microsoft Windows*
https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows

1 0
原创粉丝点击