我尝试在Android Studio中运行我的Hello World应用程序。我得到了以下错误:
模拟器:ERROR: x86仿真目前需要硬件 加速度! 请确保Intel HAXM已正确安装并可用。 CPU加速状态:HAX内核模块未安装!
你能告诉我如何处理这个错误吗?
我尝试在Android Studio中运行我的Hello World应用程序。我得到了以下错误:
模拟器:ERROR: x86仿真目前需要硬件 加速度! 请确保Intel HAXM已正确安装并可用。 CPU加速状态:HAX内核模块未安装!
你能告诉我如何处理这个错误吗?
当前回答
仅限Windows用户
这有点晚了,但刚刚发现一些答案是去bios设置,但对我来说,我能够通过禁用hyper-v功能来解决这个问题。我们通过以下步骤来做到这一点:
其他回答
在Mac上,Android SDK安装在:/Users/username/Library/Android/ SDK /,因此,你需要运行脚本sudo,如下所示:
sudo sh /Users/username/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
如果一切顺利,脚本将输出消息:“通过静默安装!”
然后,重新启动Android Studio并使用所需的AVD运行应用程序。
根据这个回复,完整的步骤是:
1)打开SDK管理器(在Android Studio中,进入Tools > Android > SDK管理器),如果没有下载英特尔x86模拟器加速器(HAXM安装程序)。
2)现在进入你的SDK目录C:\users\%USERNAME%\AppData\Local\Android\ SDK \extras\intel\Hardware_Accelerated_Execution_Manager\并运行名为intelhaxm-android.exe的文件。
如果你得到一个错误,如“英特尔虚拟化技术(vt,vt-x)未启用”。进入BIOS设置,启用“硬件虚拟化”。
3)重新启动Android Studio,然后尝试再次启动AVD。
显示模拟器窗口可能需要一到两分钟。
我已经安装了HAXM,但它是一个较旧的版本。然后我从SDK管理器更新,然后模拟器工作!
如果您使用的是AMD CPU,现在正式支持AMD虚拟化(如Ryzen CPU)。确保在BIOS中开启了虚拟化。
在“打开或关闭Windows功能”(你可以通过Windows搜索找到它)中,你需要启用它
Windows 10上的Windows Hypervisor平台17134.1(1803)2018年4月更新或更新(通常在文章中没有提到) hyper - v
重启并启动模拟器(x86版本)后,它应该开始启动,不会出现上述错误。
给我这样的傻瓜一个更详细的答案:
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盒子都是未勾选的。