简体   繁体   English

Android Studio 模拟器“找不到/dev/kvm”

[英]Android Studio Emulator “/dev/kvm is not found”

Couldn't use x86 emulators, AVD manager shows warning "/dev/kvm is not found" and telling me to edit BIOS security setting to enable VT-x.无法使用 x86 模拟器,AVD 管理器显示警告“/dev/kvm is not found”并告诉我编辑 BIOS 安全设置以启用 VT-x。 在此处输入图片说明

Re-installing HAXM resolved my problem Steps:重新安装 HAXM 解决了我的问题步骤:

  1. Make sure SDK Manager -> Extras -> Intel x86 Emulator Accelerator (HAXM installer) is installed确保已安装SDK Manager -> Extras -> Intel x86 Emulator Accelerator (HAXM installer)
  2. Navigate to <sdk> /extras/intel/Hardware_Accelerated_Execution_Manager/导航到<sdk> /extras/intel/Hardware_Accelerated_Execution_Manager/
  3. Run ./HAXM\\ installation -u运行./HAXM\\ installation -u
  4. Run ./HAXM\\ installation运行./HAXM\\ installation

For MacOS users running Android Studio, when you get this error then try these steps to open up your privacy settings.对于运行 Android Studio 的 MacOS 用户,当您收到此错误时,请尝试这些步骤以打开您的隐私设置。

在此处输入图片说明 在此处输入图片说明 在此处输入图片说明

You can also follow the answer from Divakar on this post here - /dev/kvm not found on mac你也可以按照 Divakar 在这篇文章中的回答 - /dev/kvm not found on mac

Thank you Apple for pushing me with your dumb*** app review rules from iOS to android development感谢 Apple 用你愚蠢的 *** 应用审查规则推动我从 iOS 到 Android 开发

You just need to "start" the HAXM.您只需要“启动”HAXM。 You can do this following this steps:您可以按照以下步骤执行此操作:

  1. Open the cmd.打开cmd。
  2. Type sc query intelhaxm , click enter and check the STATE.输入sc query intelhaxm ,点击回车并检查状态。
  3. If state is 1 STOPED , type sc start intelhaxm and click enter to start the HAXM.如果 state 为1 STOPED ,请键入sc start intelhaxm并单击 Enter 以启动 HAXM。
  4. Check the STATE again and it should be 4 RUNNING now.再次检查状态,现在应该是4 RUNNING
  5. Finally, you are now able to create and use your AVD using a x86 emulator.最后,您现在可以使用 x86 模拟器创建和使用您的 AVD。

Alternatively, when you want to stop the HAXM you should type sc stop intelhaxm .或者,当您想停止 HAXM 时,您应该输入sc stop intelhaxm

Hope this helps y'all.希望这对大家有帮助。

I had a similar message in the emulators area in Android Studio 2.1.我在 Android Studio 2.1 的模拟器区域有类似的消息。

My emulator for a certain API (think 21) worked initially fine and was fully accelerated, then installed a couple of other images (Nougat x86/64 etc) and suddenly started seeing /dev/kvm not found and NO emulator would boot up.我的某个 API 的模拟器(想想 21)最初运行良好并完全加速,然后安装了几个其他图像(Nougat x86/64 等),突然开始看到 /dev/kvm not found 并且没有模拟器会启动。

  • In My Case, re-installing HAXM sadly did not help, but rebooting my MAC did (go figure).在我的案例中,遗憾的是重新安装 HAXM 没有帮助,但重新启动我的 MAC 有帮助(请看图)。

  • But, I also noted that if you have installed an emulator image but not the related SDK for the API (which makes sense), then you get a similar pop-up when starting the emulator, which makes you think it may be a HAXM / KVM issue, which its not.但是,我还注意到,如果您安装了模拟器映像,但没有安装 API 的相关 SDK(这是有道理的),那么在启动模拟器时会出现类似的弹出窗口,这让您认为它可能是一个 HAXM / KVM 问题,它不是。

Hope this helps someone.希望这可以帮助某人。

Just go to terminal and type只需转到终端并输入

sudo chown 777 -R /dev/kvm,

then type然后输入

sudo chmod 777 -R /dev/kvm.

And restart android studio并重新启动android studio

And that's it..就是这样..

In some case it may happened that for every start of android studio you need to type this commands First and then start android studio.在某些情况下,可能会发生每次启动 android studio 时,您都需要先键入此命令,然后再启动 android studio。

On Mac OS, After installing make sure to allow Intel HAXM under "Security & Privacy".在 Mac OS 上,安装后确保在“安全和隐私”下允许英特尔 HAXM。

This was the only way I was able to run the Android Emulator :)这是我能够运行 Android 模拟器的唯一方法:)

Reinstalling and restarting did not work for me.重新安装和重新启动对我不起作用。 Instead, I had to start my Mac in Recovery Mode (restart & press ⌘+R until Apple logo appears).相反,我必须在恢复模式下启动我的 Mac(重新启动并按 ⌘+R 直到出现 Apple 标志)。 Then open terminal from Utilities drop down menu.然后从实用工具下拉菜单中打开终端。 Type and run:输入并运行:

csrutil enable --without kext

You will get some warnings and instruction to restart for the changes to take effect.您将收到一些警告和指示以重新启动以使更改生效。 Restart and the emulator will run this time.重新启动,模拟器这次将运行。

Reference: https://blog.celogeek.com/201708/672/android-studio-emulator-haxm-on-mac-os-high-serria-10-13/参考: https : //blog.celogeek.com/201708/672/android-studio-emulator-haxm-on-mac-os-high-serria-10-13/

I couldn't install mine because I had HyperV enabled on my machine.我无法安装我的,因为我的机器上启用了 HyperV。 Removed it and I was able to install the HAXM from the following link:删除它,我能够从以下链接安装 HAXM:

https://github.com/intel/haxm https://github.com/intel/haxm

Either your CPU does not support virtualization, or it is disabled in the bios.要么你的 CPU 不支持虚拟化,要么在 bios 中被禁用。 Go into your bios and see if you can find a setting to enable it.进入您的bios,看看是否可以找到启用它的设置。

I tried reinstalling HAXM a few times but kept getting the errors.我尝试重新安装 HAXM 几次,但一直收到错误消息。

In my case I actually had to go into Bios Settings and enable Virtualization.就我而言,我实际上必须进入 Bios 设置并启用虚拟化。

It worked for me.它对我有用。 Just in case this helps anyone.以防万一这对任何人都有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM