Can I run Android Studio and Android SDK emulator in a Microsoft hyper-v virtual machine? Please read carefully.
I already use Hyper-V a lot for other purposes. Now I need to develop a app for Android.
I've installed a new virtual machine (windows 10) and installed Android Studio. I cannot run the android emulator because it's lacking the 'intel HAXM software'.
I read a lot about that it's not possible to install Hyper-V NEXT to Android Studio, but non of the post actually say anything about installing in a Hyper-V machine.
Refer to this link:
How to run Android Studio on Windows without disabling Hyper-V
The solution (if you do not want to disable Hyper-V) is to use Microsoft’s Android emulator, which is a free download here.
In order to use this with Android Studio, you need to run the emulator first. Then, in Android Studio, go to Run > Edit Configurations... and select Show Device Chooser Dialog under Deployment Target Options.
Run your project, and select the VS Emulator, ignoring the invitation to “Turn off Hyper-V”.
Hyper-V added support for nested virtualization in the Windows 10 Anniversary Update (released August 2016) and Windows Server 2016. However, the only Microsoft-supported usage of nested virtualization is running Hyper-V within the VM, not HAXM. From the official documentation, "Virtualization applications other than Hyper-V are not supported in Hyper-V virtual machines, and are likely to fail."
That said, the change log for the latest release of HAXM reports that Intel "Fixed an issue with Hyper-V nested virtualization support, which had prevented Android Emulator from booting." So while it isn't supported by Microsoft, it seems running HAXM nested in a Hyper-V VM may be possible.
If that's the case, to get HAXM working in a Hyper-V VM, you will need to enable nesting for that VM. Run this command on the VM while it is in the OFF state:
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
After that, you should be able to install the latest version of HAXM within the VM, allowing use of the Android Emulator. Again, I haven't personally verified this, and it isn't supported by Microsoft, so your mileage may vary.
Full disclosure: I work at Microsoft on the Hyper-V team.
[Edit 7/2/2018]: Android Emulator support for Hyper-V acceleration was announced earlier this year, and is currently in preview. See the announcement post for details.
Microsoft posted a link to allow Hyper-V as hardware accelerator for android emulator run in windows.
The link is here
Here is the instructions.
Enter About in the Windows search box.
Select About your PC in the search results.
Scroll down in the About dialog to the Windows specifications section.
Verify that the Version is at least 1803.
Enter windows features in the Windows search box and make sure both Hyper-V and Windows Hypervisor Platform are checked.
Open SDK manager in Android Studio, make sure your Android Emulator version is at least 27.2.7.
Restart your computer, and relaunch your Android Emulator in AVD Manager in Android Studio.
Confirmed: Running Windows 10 version 1803, with Hyper-V and Windows Hypervisor platform enabled, Android Studio's Emulator works. I am using Android Studio 3.2.1 and Android Emulator 28.0.22.
Just make sure before you start with the steps suggested by lotosbin you complete the following:
Open an admin command prompt and enter the following; then restart the emulator.
`reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools" /v Path /d %localappdata%\Android\sdk`
Or update the registry manually:
In regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node.
Create a new key named Android SDK Tools(if not there already).
Navigate to that key.
Create a new string value named Path. Set its value to the location of your Android SDK, which will be like C:\Users\YourName\AppData\Local\Android\sdk.
Microsoft has announced a better solution
Today, at Build 2018, we announced a preview of the Google Android
emulator that’s compatible with Hyper-V, available on the Windows 10
April 2018 Update. This enables developers with Hyper-V enabled on
their machines to use a hardware accelerated Android emulator, without
needing to switch to Intel’s HAXM hypervisor. Amazing work was done by
the Windows Hyper-V team, with help from the Xamarin team, to make to
this happen.
Just to complement #lotosbin's answer and add an additional information. This information is regarding when you are trying to start your app in Microsoft's standalone Android emulator from Android Studio.
On the Select Deployment Target window there are two sections namely:
Connected Devices - It shows up physical android devices attached to your computer through USB port e.g. mobile, tablet if you want to deploy your app into an actual device
Available Virtual Devices - It shows up Android virtual emulators which are build from specific device definition e.g. Nexus 5X API 28
Interestingly, Microsoft's Android emulator shows up in Connected Devices section. So Android Studio treats Microsoft's Android emulator as a physical device instead even though it is a virtual emulator only. Please see the screenshot below:
Additionally, you can check the health and current status of Microsoft's Android emulator inside Hyper-V Manager also as shown in below screenshot:
I am looking for some help on this. I have a google compute Windows Server 2016 machine. I am trying to use it to run Android Studio and Android Virtual Devices (AVD). AVD requires that I turn off Hyper-V.
The problem is that even after turning off Hyper-V (using command prompt in admin mode, bcdedit) and restarting, the AVD manager shows hyper-v is still on.
I wanted to make sure if is is at all possibel to turn off hyper-v in Google Compute machine?
commands I have used: bcdedit /set hypervisorlaunch off
My guess is that the command is misleading you. In a GCE VM, the Intel CPU extensions that provide hardware assistance for hypervisors (specifically for GCE's hypervisor) are already on and in use. These are often called "VT-x". Android Virtual Devices work by running a hypervisor of their own, but since GCE is using the VT-x from the processor, and we do not currently provide them to the guest to use, you are not practically able to "nest" the Android hypervisor inside a GCE guest. Another similar use case that hits this limitation is Packer-based builds, as well as trying to run other hypervisors inside GCE VMs.
I believe the message you're seeing about "disable Hyper-V" is misleading you, and the real problem is that GCE VMs do not have nested hypervisor support as of this writing (I know this part is true, I am a Product Manager for GCE).
Some sites including this page suggests that the workaround is to run Microsoft's Android emulator. Seems worth a try, although if that emulator also needs hypervisor acceleration, it may not work either.
I'm trying to install Android Studio, but it's showing this error.
Is there a solution for this problem?
As #Marcin Koziński said in Intel, HAXM requires only to run the Emulator faster. Still, if you want to install HAXM, follow the steps.
Restart your PC and go to BIOS
In advanced option, Enable Virtualization and save exit
After Windows restarted, go to the SDK path of your Android Studio
Find this path \sdk\extras\intel\Hardware_Accelerated_Execution_Manager
Run intelhaxm-android.exe executable
Now, this would install HAXM software in your system. Note that your system must have Intel CPU, not AMD
Ignore this error on Android Studio installation and go to the Intel website, download the HAXM installer that they provide (instead of using the one downloaded through Android Studio).
Here's the link:
https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
and the direct link:
https://github.com/intel/haxm/releases/tag/v7.6.1
Try this :
Go to Control Panel → Program and Feature. Click on Turn Window Features on and off. Uncheck Hyper-V option and restart your system.
Now you should install HAXM with no error
Enable virtualization in your bios ( found under the cpu performance ) …then disable hypervisor and also unchecked virtual machine platform ( mostly on win 10 and win 11)
Restart your machine
Good to gooo!!
I was also facing the same issue, however i have tried below steps which worked for me.
Instead of installing HAXM from android studio, download it from
here HAXM
From - Downloads section, you can download MAC or WINDOWS release.
Install it from IntelHaxm-android file
Note - Same kind of steps we can follow for Mac.
Go to android studio SDK Manager select SDK tools and search for Intel x86 Emulator Accelerator(HAXM Installer) and install it. This should solve the problem.
I disabled tamper protection and core isolation in windows defender and it solved the issue.
If you are using Windows 10, then, be sure to disable "Windows Defender Credential Guard".
Reference: https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/credential-guard-manage
In my case, in the Window features on or off, I uncheck both the "Windows Hypervisor Platform" and "Virtual Machine Platform". After restart, the Android Studio, SDK Manager, Android SDK, SDK Tools, Intel x86 Emulator Accelerator 7.6.5 can then successfully be installed. Just uncheck the "Windows Hypervisor Platform" is not enough. My Android Studio is 4.1.3 and my Windows 10 OS build is 19041.867
Go to Control Panel → Program and Feature. Click on Turn Windows Features on and off. Uncheck Hyper-V and Windows Sandbox option and restart your system.
I enabled Virtualization in my BIOS and the installation worked, i have intel I5 CPU
Enabling Virtualization in BIOS solved the issue for me. If you have an Intel processor, you need to enable VMX in the CPU configuration file. Here is an detailed article with the steps (for asus motherboards). https://www.asus.com/support/FAQ/1043786/
I wrote a perfect documentation for that. The key is to download the HAXM driver but don't close the Android installation window after it's downloaded. You need to find it's path and run the installer .bat through Powershell or CMD. Simply follow along the mentioned guideline I wrote and you will be finde. Cheers!
If you're running on a macbook pro laptop, make sure to reboot to windows without pressing the option key for boot selection. As this will disable virtualization .
To soft reboot to windows
Soft reboot via the Apple menu i.e. top left Apple icon => restart. During bootup select Windows/Bootcamp (via the option key). My Windows was Bitlocker encrypted, so I entered the disk password, booted to Windows, entered Windows password, landed on Windows 10 desktop. This time Hyper-V was present and functional!
if the error still persists. Ignore the Android Studio installation error
Disable the Hyper-V Manager
Hyper-V is another Virtualisation env. just like Intel HAXM.
You cannot use both at the same time. Hence, It is necessary to Disable Hyper-V.
You can follow these steps to disable Hyper-V
Go to Control Panel -> Programs and Features -> Turn Windows features on or off
From the window disable Hyper-V options
Reboot your machine
or on cmd prompt with admin priveledges:
bcdedit /set hypervisorlaunchtype off
Go to the Intel website, download the HAXM installer that they provide (instead of using the one downloaded through Android Studio).
Here's the link: https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
and the direct link: https://github.com/intel/haxm/releases/tag/v7.6.1
Open BIOS setting of your PC/Laptop.
Goto Advance -> Device Configuation.
Enable VTx(Virtualization Technology).
and Try to install HAXM.
Hope this will work.
IF u have AMD CPU you have to install Driver for AMD processor(It's in SDK Tools options menu.) then go to C:\Users\YOURNAMEHERE\AppData\Local\Android\Sdk\extras\google\Android_Emulator_Hypervisor_Driver and run silent_install.bat. If it doesn't work try cloning your emulator device instead creating new one. Also, you might have to set SDK root home folder as a new variable.
when you press +creating virtual device and selcting device on the right side of it shows you HAXM installation or something ,you can check there.
I tried several times to install the HAXM but all in vain. Finally i came to an end and watched this video. This video creator is awesome and have provided the exact solution i needed to.
Here's the video link: https://www.youtube.com/watch?v=7_Ny7-y6TRA&t=113s
And
From this link you can download the software for your device.
https://github.com/intel/haxm/releases
I hope it'll help you as it does mine :)
Have tried some solutions stated above, sadly it did not work for me.
Just noticed that when I install HAXM it uninstall HAXM after installing, so what I did was after the installation even gets finished (before setting how much RAM to give it) I went to the SDK folder on %appdata% then copied the folder from Hardware_Accelerated_Execution_Manager which can be seen on extras folder then I exit android studio then paste the folder on extras/intel then it worked :D
This worked for me :
If you already disabled completely Hyper-V and it's still not working disable also:
Windows Hypervisor Platform
"The Windows Hypervisor platform is an API that third-party developers can use in order to use Hyper-V."
Ofcourse you're CPU need to be intel based and also you need to turn on Virtualization options in BIOS.
Hope it helps if not I wish you a lot of luck.
I'm adding here the official Release Notes of the HAXM.
This is not a solution answer but it will complete the solutions already mentioned in terms of requirements and known issues:
Prerequisites
Intel(R) HAXM requires the Android SDK to be installed
(version 17 or higher). For best performance, using SDK version 20 or
higher is recommended.
System Requirements
---------------------------- Hardware Requirements:
Intel(R) processor with support for VT-x, EM64T, and Execute Disable Bit
At least 1GB of available RAM
Supported Operating Systems:
Windows* 10 (64-bit)
Windows* 8.1 (64-bit)
Windows* 8 (64-bit)
Windows* 7 (64-bit)
macOS* 10.12, 10.13, 10.14
Note:
Test was NOT conducted on Windows* XP since Microsoft* will not offer support for this version.
Test was NOT conducted on 32-bit Windows since Android Emulator only supports 64-bit Windows.
Important:
Intel HAXM cannot be used on systems without an Intel processor, or an Intel processor lacking the hardware features, described in the
"Hardware Requirements" section above. To determine the capabilities
of your Intel processor, please visit http://ark.intel.com/
Intel HAXM can only accelerate Android x86 and x86_64 system images for Android Emulator. These system images as well as Android Emulator
can be installed using Android SDK Manager.
Known Issues:
HAXM driver does not support emulating a 64-bit system image on Intel systems based on Core microarchitecture (Core, Core 2 Duo etc.).
All systems based on Nehalem and beyond are supported (Core i3, Core
i5 and Core i7 machines).
QEMU or Android Emulator will fail to launch if the guest RAM size (specified with the -m option for QEMU or -memory for Android
Emulator) exceeds 4095MB.
If the guest RAM size (specified with the -memory option for Android Emulator) exceeds 3583MB, Android will either fail to boot or report
the total memory as 3.0GB.
If DriverVerifier is running on a Windows System on which HAXM is installed BSOD can happen during HAXM uninstall. Check the following
link for more information from Microsoft.
http://msdn.microsoft.com/en-us/library/windows/hardware/ff545448(v=vs.85).aspx
On Windows platform using sc query command on command line will show the driver to be in Running state even if VT is disabled in BIOS. The
Android SDK gets this information from HAXM driver whether VT is
enabled or not and displays it to user when the user starts to emulate
a device. The information in the SDK is the most accurate information
for the state of the HAXM driver.
On Windows 8, 8.1 and 10, it is recommended to disable Hyper-V from Windows Features in order for the HAXM driver to properly function.
On Windows, Avast Antivirus may interfere with HAXM and cause Android Emulator or QEMU to run very slowly. A workaround is to
uncheck "Use nested virtualization where available" in Avast Settings
If all these options stated above did not work, then I recommend you go to the BIOS settings of your PC and enable virtualization mode.
My laptop is HP x360. I had to enable virtualization in BIOS( use f10)
Then do this step https://github.com/intel/haxm/issues/105#issuecomment-470296375
if memory integrity is off inside core isolation. Switch it on.
If you get an incompatible driver error when you switch on above feature, then find and uninstall/delete it.
In my case, Tencent's gaming buddy was the driver.
In some systems, the windows feature Hyper-V is not listed. instead, it is "Windows Hypervisor Platform" <- Uncheck this.
These all may take multiple restarts.
Then finally try installing HAXM from android studio.
It should work.
As fabio-roveroto ignore this error because HAXM is used for Android Emulator.
If you want to use Android Emulator you must install HAXM please follow these steps in the below link for fixing the error:
https://support.bluestacks.com/hc/en-us/articles/115003174386?utm_campaign=bgp_product&utm_medium=app_player&utm_source=support
And If you can't find UEFI Firmware Settings in the Advanced options, please check that your PC BIOS mode is Legacy or UEFI from this link, If your BIOS mode is Legacy
check this link to convert Legacy to UEFI.
I'm trying to get into Android development in a virtual machine hosted on Hyper-V, but cannot seem to find a way to use HAXM inside the guest OS. Everything I can find seems to be about disabling Hyper-V on the machine that you want to host the Android emulator on.
For reference, the host OS is Windows 8.1 and the guest OS is a Windows 10 preview. I'm using the most recent Android IDE and Java 7 SDK, with the default emulator that comes with those.
You cannot use the Intel Accelerator (HAXM) and Hyper-V at the same time. Basically, both are hypervisors trying to use the Intel VT (virtualization) extensions of your CPU at the same time, and this is not possible.
Hyper-V is a type 1 hypervisor (on bare metal) that takes full ownership of the Intel VT extensions of your processor.
Any other type 2 hypervisor (e.g HAXM or VirtualBox) trying to use the VT extension of the CPU will fail or cause a system error
An operating system running in a VM cannot access the VT extensions without the help of the parent hypervisor. HAXM running in a VM cannot access the VT extensions if it runs on Hyper-V. Hyper-V supports nested virtualization, i.e. a Hyper-V in a VM running on Hyper-V, but you may require specific versions of the OS and some time configuring all the stuff. Windows 10 supports Windows Containers but I think you cannot use that technology to run the emulators.
You can use the official Android emulator. This emulator may take advantage of HyperV for improved performance. You must uninstall (or avoid to run) the HAXM. You can connect your development VM to the android VM using its IP address.
Some time ago, the only alternative for running an emulator with HyperV was the the Android Emulators for Visual Studio (that you may use with Eclipse or Android Studio, without installing Visual Studio). Although these emulators can be used nowadays, Microsoft is recommending developers use the official Android emulators.
Finally, if you want to use HAXM, you can configure an additional boot entry in your Windows and use a type-2 hypervisor such as VirtualBox. You can use BCEDIT to select at boot-time if the machine must start with the Hyper-V or not. You must restart your computer each time you want to enable/disable Hyper-V. To create an additional boot entry, you may check here and here
I tried this once before but I had issues with it. I tried running Android Studio on vmware fusion but the emulator always showed a black screen. LAter I found out the reason which was 'you cannot run one virtual machine on another.'.
The android emulator running with Adnroid Studio is a virtual machine which I was trying to run in vmware fusion so it never worked.
I am unable to launch my Android App's simulation. I get the error:
"Please ensure INTEL HAXM is properly installed and usable"
"CPU acceleration status: HAX Kernel module is not installed!"
I installed the above mentioned modules and got the same results. Read around and was told that I need to activate the virtual simulation property from my BIOS only to realise my motherboard doesn't support it - no option for it. (I am using a MSI G43-Z87 Motherboard).
Is there any other way I could use a Virtual Simulator in my case (Free)?
Try this answer.
From the link:
HAXM is Intel's virtualization extension for Android Emulator on x86. You can use an emulator with the ARM image instead of HAXM provided that you installed it in the SDK manager.
Check your SDK manager to see if you have an ARM image instead for the API level you want, then go to the AVD manager and make a virtual device using ARM as the cpu.
Use your Android phone or tablet instead of Emulator. Emulator is unusable if your motherboard not support intel VT. Also can install VMBox or like. Also can buy new pc with core I7