我尝试在Android Studio中运行我的Hello World应用程序。我得到了以下错误:

模拟器:ERROR: x86仿真目前需要硬件 加速度! 请确保Intel HAXM已正确安装并可用。 CPU加速状态:HAX内核模块未安装!

你能告诉我如何处理这个错误吗?


当前回答

(编辑) Android开发人员页面已经更新了一个很好的指南,让模拟器启动和运行。 (/编辑)

使用Android SDK管理器安装Intel x86 Emulator Accelerator

如果你安装了Android Studio,你可以通过Tools -> Android -> SDK管理器启动SDK管理器。

Android SDK管理器实际上并不安装HAXM,它只是下载它。在Android SDK管理器窗口的顶部,您可以找到安装程序在您的PC上的位置。请打开extras\intel\Hardware_Accelerated_Execution_Manager子文件夹,手动运行安装程序:intelhaxm-android.exe。

要使用intel HAXM,你需要有一个支持虚拟化的CPU:

在尝试使用这种类型的加速之前,您应该首先 确定开发系统的CPU是否支持其中一种 以下虚拟化扩展技术: 英特尔虚拟化技术(VT, VT-x, vmx)扩展 AMD虚拟化(AMD- v, SVM)扩展(仅支持Linux)

(编辑) 截至2019年11月27日,谷歌发布了一款适用于AMD cpu的模拟器。 (/编辑)

如果你的CPU不支持虚拟化,你可以使用ARM模拟器:

您可以编辑现有的虚拟设备,或在Android中添加新的虚拟设备 虚拟设备管理器,修改“CPU/ABI”为“ARM”。 如果该选项不可用,您可能需要更改虚拟设备的目标API,或下载 你想要使用Android SDK的API版本的ARM系统映像 经理。

其他回答

我遇到了同样的问题,但在我的BIOS上关闭Hyper-V并启用VT-x后,我仍然无法安装intelhaxm-android.exe程序。

为了解决我的问题,我不得不关闭Windows防御程序内存完整性

检查这里的步骤-> https://github.com/intel/haxm/issues/105

给我这样的傻瓜一个更详细的答案:

Open the SDK manager Select the SDK Tools tab. Download – Make sure that intel x86 Emulator Accelerator (HAXM) is downloaded. Install – Now that HAXM is downloaded, make sure it is installed. In the SDK window it will show you where the SDK is located on your computer: Click/tap 3 times quickly to highlight this text and copy the folder location. Open the file explorer and paste in the file location. From here you can search “hax” to find the folder location for HAXM stuff. Once a file comes up in the search results, right click and select “open file location”. For me the location was C:\Users\Datu1\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager . Find the file intelhaxm-android.exe and open/run it. Follow the instructions when it runs. You may wish to run haxm_check as an administrator (it’s in this same folder), but it may or may not work for you. The surefire way to tell if you can run hardware acceleration and if it’s enabled is to go to your computer’s bios settings from the startup menu. BIOS settings – Make sure hardware acceleration is enabled in your BIOS settings. The way to do this may vary a bit from system to system. You may need to press f10 or esc on startup. But with most (updated) Windows 10 computers you can access the BIOS settings by doing the following: type “advanced startup” in the Windows search bar; click on “change advanced startup uptions:” when it comes up. Click “Restart now”. After your computer restarts click on Troubleshoot. Click advanced options >firmware settings, then restart to change EUFI firmware settings. Wait for the restart then select the menu option for bios settings. With Intel processors the steps will be as follows or similar: Press the right arrow to go to the Configuration tab. Arrow down to Intel Virtual/Virtualizaion Technology and turn it on (should say Enabled). Exit and save changes. If Virtual Technology was previously disabled in your bios settings You will need to run the intelhaxm-android.exe file now to install haxm. Try restarting Android Studio and running your emulator again. If it’s still not working, restart your computer and try again, it should work.

注意:如果你打开了Windows Hyper-V,这将导致你不能运行haxm。如果你有hyper - v的问题,确保它在你的设置中被关闭:在Windows栏中搜索“hyper”;搜索结果会显示“打开或关闭Windows功能”。然后确保所有的Hyper-V盒子都是未勾选的。

我能够解决我的问题,缺少加速与以下工作流程在Windows 10,联想,英特尔酷睿i7 CPU:

更改为HAXM安装文件夹: 当地C:\Users\ \ AppData \ \ Android Sdk \ \配件\ \ Hardware_Accelerated_Execution_Manager英特尔

打开cmd (MS-DOS) shell窗口,执行haxm_check.exe检查CPU是否支持HAXM -在我的情况下输出:

VT support -- yes
NX support -- yes

所以,我知道这是一个设置问题。因此,我在与Admin帐户相同的文件夹中启动了安装程序intelhaxm-android.exe,并删除了已安装的组件。在那之后,我尝试用相同的安装程序重新安装,并得到以下输出:

所以,我进入BIOS的CPU部分,打开加速/虚拟化-回到安装程序并重新运行它,这次我很高兴地看到如下输出:

之后,我重新启动Android Studio,并使用Tools>AVD Manager为模拟器定义了一个新的图像。然后,我可以通过点击AVD管理器列表中的模拟器列表中的播放按钮,看到模拟器成功启动:

或通过 -打开一个编译OK的示例项目 使用文件>同步项目与Gradle文件(构建所有工件) -在Android (TW)中选择应用程序项目,并单击运行>运行'app' -选择之前配置的模拟器显示我这个:-)

希望这有助于排除其他人的问题,这是真正由一个糟糕的设置实现造成的,因为缺少加速选项被Android Studio设置程序默默吞噬…: - (

以下步骤在Mint 17.2 Rafaela上有效:

打开终端,输入:sudo apt-get install qemu-kvm 重启你的电脑,在BIOS设置中启用虚拟化技术 再次在终端中插入:sudo kvm-ok

仅限Windows用户

这有点晚了,但刚刚发现一些答案是去bios设置,但对我来说,我能够通过禁用hyper-v功能来解决这个问题。我们通过以下步骤来做到这一点: