这两天在编译安卓源码的时候出现一个在网上比较难查到的问题,记录以下。
在源码编译完成,使用命令emulator
来启动虚拟机的时候,在10.13的mac系统上会出现报错
Failed to open the hax module
Warning: requested RAM 2048M too high for your system. Reducing to maximum supported size 0M
Hax is enabled
Hax ram_size 0x0
Failed to open the hax module
No accelerator found.
failed to initialize HAX: Operation not supported by device
核心的错误就是
Failed to open the hax module No accelerator found.
然后根据错误去网上查询时,给出的解决方案是重新安装haxm插件。 但是我重新安装启动之后还是会出现一样的问题。
然后用kextstat | grep intel
命令来查看haxm是否成功运行, 发现是没有内容输出的。
然后使用sudo kextload –b com.intel.kext.intelhaxm
来尝试启动haxm, 但是出现另外一个错误
/Users/xxxx/–b failed to load - (libkern/kext) not found; check the system/kernel logs for errors or try kextutil(8).
/Users/xxxx/com.intel.kext.intelhaxm failed to load - (libkern/kext) not found; check the system/kernel logs for errors or try kextutil(8).
通过这个错误去网上查询之后发现是 在 haxm 安装的时候少了一个步骤。
10.13 之后的mac系统在安装 haxm的时候 需要在系统偏好设置->安全性和隐私
里面来允许haxm的安装。
具体步骤 是在 sdk的目录下面点击 haxm的 dmg文件安装之后,一段时间内在 安全性和隐私里面会有个提示内容, 需要用户点击允许,如图。
然后重新安装一次 haxm 在使用
emulator
命令就不会报错来。问题解决!
网友评论