/dev/kvm is not found on Mac OS - android

I recently updated my Macbook pro to Mac OS High Sierra. Now I'm running into an issue where I can no longer start the emulator in Android Studio.
The warning /dev/kvm is not found. is shown. When I tried to start the emulator I get the following error:
I tried different versions of Intel HAXM from the SDK manager and standalone, reinstalling Android Studio and completely removing all configurations, still the same issue..

Go to:
System Preferences > Security & Privacy > General
There should be a message like “System software from developer xxx was blocked from loading.”
Click Allow

To use VM acceleration on a Mac, you must install the Intel HAXM kernel extension to allow the emulator to make use of CPU virtualization extensions. Android Studio requires Mac OS X 10.8.5 or higher, up to 10.11.4 (El Capitan) Mac OS X; the kernel extension is compatible with Mac OS X 10.6.0 and higher.
To install the Intel HAXM kernel extension, follow these steps:
Open the SDK Manager.
Click the SDK Update Sites tab and then select Intel HAXM.
Click OK.
After the download finishes, execute the installer.
For example, it might be at this location:
sdk/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM_version.dmg.
To begin installation, in the Finder, double-click the IntelHAXM.dmg file and then the IntelHAXM.mpkg file.
Follow the on-screen instructions to complete the installation.
After installation finishes, confirm that the new kernel extension is operating correctly by opening a terminal window and running the following command:
kextstat | grep intel
You should see a status message containing the following extension name, indicating that the kernel extension is loaded:
com.intel.kext.intelhaxm
Reference

It seemed to be an Intel HAXM issue. I resolved it by completely removing Intel HAXM.
Then I followed this guide, which basically makes you edit the install script of HAXM so the silent installation will work on Mac OS High Sierra.

I found the answers provided by #AresDev & #ShubhamJain to be super helpful for the uninstallation & re-installation of HAXM, but in my case it still didn't resolve the /dev/kvm not found errors I was seeing. My Mac OS High Sierra was blocking the AVD / Intel extensions from running correctly, and I had to Allow it under System Preferences > Security & Privacy > Allow.
However, the Allow button doesn't respond in some situations! I had to quit Google Chrome, before could click Allow, as described in these posts: "Github Karabiner Elements Issues"

Related

Android Studio Emulator is not working on Windows 11 when WSL2 is installed

Setup:
Windows 11 Home 21H2 22000.132
AMD Ryzen 5900X
WSL2
Android studio lastest build (also tried with latest beta)
Problem:
As soon as I install WSL2, the emulator stops working. It's giving the following error message:
C:\Users\gusta\AppData\Local\Android\Sdk\emulator>emulator.exe -avd Android_TV_1080p_API_300
emulator: Android emulator version 30.8.4.0 (build_id 7600983) (CL:N/A)
handleCpuAcceleration: feature check for hvf
added library vulkan-1.dll
Failed to open /qemu.conf, err: 2
C:\Users\gusta\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=c0350005
C:\Users\gusta\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument
Using WSL2 at the same time as the android emulator was working before on an Intel i7 4770k processor, but stopped working after a processor upgrade to a AMD Ryzen 5900x and fresh install of Windows 11.
For clarification: I'm not trying to run the emulator from WSL2, I'm trying to run it from Android Studio. When trying to start it from Android Studio it never launches, when trying to run it from the Windows Command Line I get the above error.
The "Failed to open /qemu.conf" is possible to solve by creating that file manually, as explained by this answer. That however doesn't fix the two later errors with WHPX.
I've followed the official instructions on this page (Following the AMD with Hyper-V option WHPX). I think the problem has to do with Hyper-V running which WSL2 is using if I'm not misstaken. But according to the above link it should be possible to run the emulator at the same time as Hyper-V using WHPX. I've also tried using the Android Emulator Hypervisor Driver for AMD processors, which is giving me the exact same result.
Activated Windows features:
Thankful for any help, and please tell me if I need to add more information
Newer Answer
I found and tested in shorter toggle mechanism.
The configuration for Windows Feature:
Windows Subsystem for Linux is installed.
Windows Hypervisor Platform is installed.
Hyper-V is installed.
If you need the Emulator, you only need to turn off Hypervisor + Restart. Run: bcdedit /set hypervisorlaunchtype off
If you need the Docker back, you can run the hypervisor hence disabling Emulator. Run: bcdedit /set hypervisorlaunchtype auto
You need to restart after setting Hypervisor
You cannot run both at the same time. Another forum worth checking in How about running docker? in my older answer below.
Older Answer
I think I solved this issue, tested to run from CMD / Android Studio and ran perfectly as before installing WSL. There are several step we go:
Configuring Windows Feature:
Removed Windows Subsystem for Linux
Removed Windows Hypervisor Platform
Removed Hyper-V
Here is my current setup:
Reverting AVD setup
I know after removing there are some odds because the AVD still get the same error as before and expected to get into WSL. I stumbled and found something when ran:
C:\Users\[NAME]\AppData\Local\Android\Sdk\emulator\emulator-check.exe accel
That command will check the current accel. It explains that the Hypervisor need to be set off and give specific help:
run bcdedit /set hypervisorlaunchtype off.
After running the bcdedit, I restarted and all is reverted. Now I can run emulator both from CMD and Android Studio perfectly.
How about running docker?
Sad truth, yeah you cannot run both pararel. There are several workaround in this forum:
How can I run both Docker and Android Studio Emulator on Windows?
Several option ranging from changing emulator, add & remove docker when in need using above step, created nested vm, etc. My personal choice right now is using another Emulator for the time being and removed docker for the latter.
I finally got this working using this fix (answer number 48). Seems like a valid workaround until windows fixes this issue. I downloaded the compiled version for windows and moved it to my emulator path C:\Users\<username>\AppData\Local\Android\Sdk\emulator. Seems to be versions available for linux and mac as well but I haven't tested those.
This issue is tracked by Google bug https://issuetracker.google.com/issues/202188690
This problem only occurs with AMD processors, I have two systems both with WSL2 and Docker running on the latest Windows 11 (Insider Beta) build. One with an AMD Ryzen 5950 and one with an Intel i7-8086K.
On the Intel system the emulator runs fine with hardware acceleration together with WSL2 and Docker.
On the AMD I run into the same error when running the emulator with hardware acceleration. In the Windows 10 Insider builds before Windows 11 it still worked.
A very similar problem was introduced before in Windows 10 build 10.0.21292
and later fixed in build 21327. (https://github.com/microsoft/WSL/issues/6471) But this problem affected both Intel and AMD.
I haven't tried to turn off the AMD fTPM yet, as this is the only other change apart from updating Windows 10 Insider (dev ring) to Windows 11.
The Android Emulator Hypervisor Driver for AMD processors only works when the Windows Hypervisor is disabled, it's not used for WHPX.
The Windows Feedback is full of reports of this problem, please upvote them.
Android Studio emulator doesn't support run Hyper-V on Windows 11, we can disable Hyper-V to run but if we do that applications which require Hyper-V to run like WSL2, Docker then fail to run.
While waiting Google update Android Studio emulator support Hyper-V we have a workaround solution to run both by using another emulator which support Hyper-V like Bluestack 5 version "Nougat 64 bit (Supports Hyper-V)" at the link below
https://www.bluestacks.com/download.html
If you did all of those steps and still you are facing that emulator termination issue, then please upgrade or download your graphic card drivers and install it. After I installing Windows 11 this issue happened to my android studio emulator. Lot of steps I followed but nothing work. after that I checked my Graphic card drivers and install it. Now emulator working fine...

Running android emulator with Azure windows 10

I am trying to run an android emulator on an azure VM running windows, Windows 10 Pro version 1809 - But I am getting the following error message running the android emulator:
C:\Program Files (x86)\Android\android-sdk\emulator>emulator -AVD androidemulatorapi28
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure the Windows Hypervisor Platform (WHPX) is properly installed and usable.
CPU acceleration status: HAXM is not installed on this machine
The hyper-v is enabled:
And Windows Hypervisor Platform as well:
The size of the VM is D2_v3 and Dv3 - series is supposed to support Nested Virtualization. Here, here and here are claims about it being so and that android emulator functions. And as I far as I have understood:
...is part of Dv3 series.
What could be the problem?
I am able to run an Ubuntu VM in Hyper-V of the Azure Windows VM.
Disabling Hyper-V and Windows Hypervisor Platform, installing HAXM and running I get this error:
According to the writer of this medium article and this StackOverflow discussion - A special custom implementation of OpenGL is necessary - because the particular azure VM size doesn't come with a GPU. However, following the steps of the article I get another type of crash - when using the Mesa3D+LLvmpip version of opengl32.dll from the authors Github repo, replacing the OpenGL file in system32 and running the android emulator:
I found there was a gihub repo - distributing Mesa3D and LLvmpip - downloading mesa3d-19.1.3-release-mingw.exe and running the cmd file:
There is the following message in cmd:
This deployment utility targets systems without working GPUs and any use case
where hardware-accelerated OpenGL is not available. This mainly covers
virtual machines in cloud environments and RDP connections. It can be
used to replace Microsoft Windows inbox OpenGL 1.1 software render
driver with Mesa3D soft pipe, llvmpipe or SWR driver.
...which seems to be a fit for the driver rendering problem.
I was able to git rid of all cmd warnings and error by-avd myandroidemulatorapi28, and any with of following two flags -gpu angle_indirect or -gpu swiftshader_indirect. And set QEMU_AUDIO_DRV=none before running it. The GUI message about the driving issue still comes up and there is a black screen.
According to the owner of the mesa-dist-win GitHub repo - he could reproduce the GUI message diver complaint and still run the emulator successfully - when imitating the state of a VM with his machine.
Note: This is not a solution, this is for sharing details of what I learned after trying out around 10-20 ways:
To enable virtualization in azure VDI, you need to enable Hyper-V feature.
After that you can see in your task manager->Performance that the virtualization is set to true.
If not, try enabling it from command prompt.
bcdedit /set hypervisorlaunchtype auto
After that virtualization is enabled.
Now, you won't be able to install Intel HAXM, as there is a race condition between Hyper-V and Intel HAXM for virtualization.
So, Without Intel HAXM, AVD won't run.
Without Enabling Virtualization with Hyper-V, there will be just black screen in AVD, and it won't boot.
So, I believe there is no solution to this problem until now, I have search everything on google, stackoverflow. If someone finds a solution, please post it over here.
Im facing the same issue with you using Win10 or Windows Server 2019 for DV3 and EV3 series. But I got it working on ubuntu if you are open for that option. No hyper v or haxm required, it is using KVM
Just go to the link "https://github.com/intel/haxm".
Scroll down to find "Downloads".
Download the "haxm-windows_v7_7_1.zip" for windows & haxm-macosx_v7_7_1.zip for macoxs.
Install the package and it will solve the issue.
They is another android emulator that is working
https://www.sanganakauthority.com/2020/04/run-android-emulator-and-android-studio.html

Hardware acceleration is installed but Visual Studio for Mac can't find it. How do I proceed?

I installed Visual Studio last year and have been using it for .Net development. Everything has been working fine so far. I use XCode for IOS development. I want to start doing Android development. When I try to use the emulator I get the following message:
emulator: WARNING: encryption is off emulator: ERROR: x86_64 emulation
currently requires hardware acceleration! Please ensure Intel HAXM is
properly installed and usable. CPU acceleration status: HAXM is not
installed on this machine (/dev/HAX is missing).
I took its word for it and installed Intel HAXM. While installing, HAXM said it was already installed and asked if I really wanted to continue. I assumed that the previous installation had issues and told it to continue. When the dust settled I was back to where I started. Visual Studio for Mac still claims that HAXM is not installed.
What do I do now?
Android apps do run on a connected device (i.e. the problem is limited to running on emulation devices).
System Configuration:
MacOS High Sierra -
Mac Mini (Mid 2010), 2.4 GHz Intel Core 2 Duo,
16 GB 1067 MHz DDR3,
NVIDIA GeForce 320M 256 MB
This question is similar to /dev/kvm is not found. Intel HAXM is not being installed properly because it is being blocked by "Security & Privacy". OSX has a wonderful security design. If it blocks something it does not tell you. If you do something else before checking you will never know what happened because it hides the message stating what was blocked.
To address this problem re-install Intel HAXM. Open select allow Intel HAXM
In my case, I had done other things after installing Intel HAXM so I did not have the option to "Allow" it. I had to go through the complete install process again before the option appeared. In addition, I found a long list of other things that had been blocked.

Intel HAXM on macOS high sierra (10.13)

Is there any way of using Android emulator on High Sierra (10.13)?
When I run
./HAXM\ installation -u
It says:
HAXM silent installation only supports macOS from 10.8 to 10.12 !
The command line installation doesn't work and gives unsupported mac os version error, while the installation through IntelHAXM_6.2.1.mpkg works but kext is not loaded due to "Approved Kernel Extension Loading" changes,
So you will need to allow the extensions from Intel and restart your mac,
then launch the emulator like from inside Android Studio,
To enable go to System Preferences > Security & Privacy as shown in the screenshot:
I was able to install Intel HAXM drivers on my Mac using the instructions provided in this post. There might be other (better) solutions to this, but I have successfully managed to start the emulator this way. Essentially you need to disable the security protection on kext before trying to install the HAXM drivers.
This command will only work on Recovery OS, which means that you need to restart your Mac and hold command + R until the Apple logo is displayed. Next, you need to go to Utilities > Terminal and run:
csrutil enable --without kext
Then restart your Mac and log in, go here to download the latest Intel HAXM driver. Unzip if needed, edit the silent_install.sh file and search for the 10.12 OS version. You will find it on the line which should look like this
for v in 10.8 10.9 10.10 10.11 10.12
You need to add the 10.13 version after 10.12 (separated by space, just like the rest). Save the file and open a Terminal at this location. Run ./silent_install.sh and that should be it. To be sure it works, you can also run sudo kextload -bundle-id com.intel.kext.intelhaxm.
Now your emulator should work.
In order to re-enable the kext security protection, you need to restart your Mac in Recovery OS, open a Terminal window and run csrutil enable.
Intel Corporation just fixed it and released HAXM for macOS Sierra and macOS High Sierra, just download the ZIP and execute the .dmg file, then restart Android Studio. It worked for me, hope it works for you too.
Intel Link for the download : https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement-macosx
Use the new Hypervisor.Framework support on macOS.
Add this line in ~/.android/advancedFeatures.ini (create this file if it doesn't exist already).
HVF = on
Issue answered here:
https://issuetracker.google.com/issues/62395878#comment7
That's worked for me.
Also you can be updated with Intel HAXM as they fixed this error.
Download HAXM latest version here (Restart macOS Required):
https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement-macosx
Hope it help.
To verify that Intel HAXM is running, open a terminal window and execute the following command:
kextstat | grep intel
If Intel HAXM is operating correctly, the command will show a status message indicating that the kernel extension named com.intel.kext.intelhaxm is loaded.
Try to stop and stat again HAXM., than verify it works correctly.
To stop Intel HAXM, use the following commands:
sudo kextunload -b com.intel.kext.intelhaxm
To start Intel HAXM, use the following commands:
sudo kextload -b com.intel.kext.intelhaxm
You can use Google's 6.2.1's silent_installer.sh to properly install HAXM on High Sierra:
https://dl.google.com/android/repository/extras/intel/haxm-macosx_r6_2_1.zip
Otherwise use Android Studio's SDK Manager to download and install it for you:
This was not introduced until 6.2.1(Google Distribution only) which looks like a hotfix from the 6.2.0 version which would throw the following message:
HAXM silent installation only supports macOS from 10.8 to 10.12!
If you don't want to use HAXM, you can use the Hypervisor.Framework by ensuring you have installed Android Emulator 26.1.3
Documentation
The emulator is now fully compatible with macOS 10.13 High Sierra through either Hypervisor.Framework or HAXM 6.2.0.
https://developer.android.com/studio/releases/emulator.html#26-1-3
Try using Hypervisor.Framework as mentioned in this post.
https://issuetracker.google.com/issues/62395878
If you have already installed the latest Intel HAXM Manager (v6.2.1) then re-install it and restart your computer. It will fix the emulator problem. You will be able to run emulators again. Here is the link:
https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm
Download this https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement-macosx
and install .dmg then restart pc.This worked for me.
I had to go to System Preferences > Security & Privacy, click the unlock button, and a message will pop up asking to allow Intel to run. After that, HAXM ran on High Sierra.
very specific case: if you keep android studio and sdk in separate partitions, and then you moved sdk to newly formatted partition, then in my case only uninstalling android studio and reinstalling it with new sdk is helped. sad story..

Android SDK's Intel HAXM disabled after installing Hyper V

I'm developing a suite of mobile apps - specifically Windows Store/Mobile 8 and Android.
Having installed VS2012 and then Monodroid, I was then able to start x86 Android images in the emulator and take advantage of the Intel HAXM acceleration (emulator output confirms HAXM working) to make the VM buttery-smooth.
I then installed the Windows Phone 8 SDK - which enables the Hyper V role - and now the emulator says it can't find HAXM. I then uninstalled and tried to reinstall HAXM, but now it won't - saying that my processor doesn't support it.
The VT-x extensions are still enabled in the BIOS - so I'm thinking that Hyper-V has blocked the Intel HAXM from working.
Of course it's not a killer - but a non-accelerated Android image is considerably slower than one with HAXM enabled - anybody else encountered this problem? Googling isn't bringing up anything obvious...
Update (30th Nov 2012)
Per #alexw's suggestion I tried stopping & disabling Hyper-V; with a restart. It still doesn't work.
I realise the next step is probably to the Windows Phone SDK (and remove Hyper-V) and then try again - to confirm that it really is the presence of Hyper-V. At the moment this is less than convenient - but I'll try and do it soon and update.
The best thing you can do to get HAXM detect VT again, is turning the whole Hyper-V "Feature" off. Open "Control Panel -> "Programs" -> "Turn Windows features on or off" (under "Programs and Features") and locate "Hyper-V", uncheck, reboot.
Looks like Hyper-V and HAXM are mutually exclusive, which is kind of a nuisance, because you even need to reboot twice to enable or disable either feature.
I was in your same case that needed to support Hyper-V and Intel HAXM. Disabling and enabling the feature and then restarting was overkill so I found an alternative solution.
You can create 2 boot entries, one for Windows with the regular configuration of Hyper-V enabled and another one with Hyper-V disabled. I logged in with the second one (Hyper-V disabled) and I was able to install Intel HAXM.
To accomplish this you need:
Open a command prompt as Administrator
Enter the command: bcdedit /copy {current} /d "Windows 8 - No Hyper-V"
This will output an id with the format {GUID} that you need to copy it to use it in the next command.
Enter the command: bcdedit /set { copied GUID of step 3 } hypervisorlaunchtype off
More details in this post.
I had a similar problem installing HAXM on Windows 8. I did the following with no effect:
Disabled hypervisor using the instructions here (http://blogs.msdn.com/b/virtual_pc_guy/archive/2008/04/14/creating-a-no-hypervisor-boot-entry.aspx)
Double checked that processor supported VT-x and was enabled in BIOS (BIOS said "supported", but there was no option to turn it on
Verified that all Hyper-V services in control panel were stopped (and never automatically started)
Performed a complete shutdown and a cold boot up.
However, I tried installing VirtualBox after the above actions (VirtualBox installed fine) and created a new VM. Running the VM caused my machine to blue screen, but after the reboot HAXM installed fine. Perhaps running VirtualBox flips some sort of flag at the OS level to allow HAXM to install.
I was also running AVAST at that time, and according this (Running the new Intel emulator for Android), that may cause a problem. However, I didn't have to disable AVAST to get HAXM installed.
You could try stopping the Hyper-V service when not needed and re-enabling it when you want to work on a WP8 project. It's a pain but the performance improvement offered by HAXM is immense.
Open services.msc, find the hvboot service (Hyper-V) and stop it. If this doesn't help you may need to disable the service and restart your pc.
I had the same problem. After a long search I found the answer. In my case, I had installed Avast Antivirus, first uninstall avast, reboot your PC, install Haxm, reboot. you can install again antivirus.

Categories

Resources