21

I just update Visual Studio 2017 to version 15.8.0, the one that I've been waiting for a while now, due to its support for Hyper-V accelerated Android emulators using Windows Hypervisor Platform (WHPX).

I've been running Windows 10 version 1803 since May, and I have installed/enabled Windows Hypervisor Platform from "Turn Windows features on or off". Also, I have updated Android SDK and tools as it's described in https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration.

However, when I run any of the accelerated emulators, I get an error:

We've encountered an error with your Windows Hypervisor Platform (WHPX) configuration that is preventing us from running your emulator accelerated.

Please ensure WHPX is properly installed, then perform a factory reset on the emulator and try again.

No log and nothing else. Hence, I'm a bit confused and don't know what I should do next.

Appreciate any help.

P.S. Couple of clarifications:

  • I tried both, resetting existing emulators and creating new ones.
  • I run Hyper-V virtual machines and Docker containers on the same PC.
Community
  • 1
  • 1
TheBlueSky
  • 5,526
  • 7
  • 35
  • 65
  • Have you tried to create a new emulator or reset the current on? – JamesMontemagno Aug 20 '18 at 14:42
  • @JamesMontemagno, yes I have tried both and the result was the same. – TheBlueSky Aug 20 '18 at 15:51
  • @TheBlueSky, Could you share a gist with Device Manager logs located in C:\Users\\AppData\Roaming\XamarinDeviceManager\? – Dmitriy Kirakosyan Aug 21 '18 at 16:10
  • @TheBlueSky Can you upgrade your Android Emulator version to 27.3.9? What is the current version inside the SDK Manager? – Jon Douglas Aug 21 '18 at 16:36
  • @JonDouglas, I'm already running Android Emulator v27.3.9 and it's the latest version as per Android SDK Manager. – TheBlueSky Aug 22 '18 at 07:53
  • @DmitriyKirakosyan, this is the log from today https://gist.github.com/TheBlueSky/c5d12eb732231552cd91c3ed0c45afc0. Sorry, the file is too long and I'm sure most of it is not relevant. If you want, let me know how I can share the relevant parts only. – TheBlueSky Aug 22 '18 at 08:01
  • @TheBlueSky The logs show no hypervisor available (WHPX or HAXM). Can you ensure WHPX is enabled via in Powershell using `Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform -All` or Command Prompt using `DISM /Online /Enable-Feature /All /FeatureName:HypervisorPlatform` ? Make sure these prompts are run as admin. You can also ensure that `Windows Hypervisor Platform` is enabled in the `Windows Features` UI. – Jon Douglas Aug 22 '18 at 19:05
  • @JonDouglas, "Turn Windows features on or off" UI shows it is enabled and Powershell script `Get-WindowsOptionalFeature -FeatureName HypervisorPlatform -Online;` shows the same; not sure what else to do to, and not sure why the log shows it isn't enabled. Any idea what command the emulator run to get this result? – TheBlueSky Aug 23 '18 at 15:11
  • @TheBlueSky Should be nothing more than going to your {sdk}/{emulator} path on a command line and using the command `emulator -avd {avd_name}`. The emulator is smart enough to pick up what hypervisor is enabled on your machine. Add the `-verbose` command as well and provide us your output. Use `emulator -list-avds` if you don't know the name to provide. – Jon Douglas Aug 23 '18 at 15:23
  • @JonDouglas, I created a Gist, https://gist.github.com/TheBlueSky/4742043458b42ab2f56361977c789e04, which contains the output of `Get-WindowsOptionalFeature -FeatureName HypervisorPlatform -Online;`, `.\emulator -list-avds;`, and `.\emulator -avd Android_Accelerated_x86_Nougat -verbose;`. – TheBlueSky Aug 23 '18 at 16:51
  • My first guess would be this: `emulator:Android emulator version 26.0.3.0 (build_id 3965150) emulator:Found AVD name 'Android_Accelerated_x86_Nougat'` Ensure you have 27.3.8+ installed locally and create a new AVD. – Jon Douglas Aug 23 '18 at 17:22
  • @JonDouglas, haven't noticed the version in the logs, but this is strange. "Android SDKs and Tools" tool says I have 27.3.9 installed (https://imgur.com/a/x9Z3qmV). Anyways, will try to uninstall and reinstall it. – TheBlueSky Aug 23 '18 at 19:28
  • @JonDouglas, after uninstalling the emulator, now the latest version shows in "Android SDKs and Tools" is 27.2.7. I installed it anyway and it obviously didn't work with WHPX. – TheBlueSky Aug 23 '18 at 19:39
  • @JonDouglas, 2 updates. (1) I forgot that last time, about a month ago, I installed the emulator 27.3.9 using Google Repository, so I did the same now because Microsoft Repository shows only 27.2.7. (2) In my previous Gist, I ran the emulator from `android-sdk\tools` instead of `android-sdk\emulator` (my bad). Now I installed 27.3.9 again and ran `.\emulator -avd Android_Accelerated_x86_Nougat -verbose;`. Still, no luck, albeit the version is now shown as `27.3.9.0 (build_id 4899998)` (see the updated Gist). – TheBlueSky Aug 23 '18 at 20:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/178642/discussion-between-jon-douglas-and-thebluesky). – Jon Douglas Aug 23 '18 at 21:31
  • @JonDouglas, did this issue die? :( – TheBlueSky Sep 21 '18 at 12:07

5 Answers5

17

Maybe the Virtualisation is not enabled for your CPU from the BIOS menu. Boot to your BIOS and Enable Virtualisation. Also, install or reinstall these features on windows. enter image description here

Kayvan Karim
  • 2,986
  • 2
  • 18
  • 18
  • 2
    I believe it is enabled; I run Hyper-V virtual machines and Docker on the same machine. – TheBlueSky Aug 26 '18 at 15:24
  • I struggled a lot and tried many solutions. My problem solved by enabling virtualisation from CPU and reinstalling the Hyper-V and Windows Hypervisor Platform. I hope you will find your answer. – Kayvan Karim Sep 01 '18 at 07:48
  • 1
    I wish if my situation was like yours :) Unfortunately, I already have virtualisation, Hyper-V, and Windows Hypervisor Platform enabled, but still cannot make it work. Here is a screenshot of [Windows Features](https://imgur.com/3ZSuc0H) on my PC. – TheBlueSky Sep 02 '18 at 13:28
  • 2
    The 3rd option was missing for me. I originally dismissed your answer, but realized that I hadn't checked the 3rd one. It must be new because all my virtual machines worked fine with the first two options checked. – Lee McPherson Oct 20 '18 at 16:32
  • @LeeMcPherson, unfortunately, my issue isn't the same. As I noted in my reply to Kayvan and my screenshot [here](https://imgur.com/3ZSuc0H), I have all the required options installed, but the issue still persists. – TheBlueSky Oct 20 '18 at 16:43
  • hey did you manage to solve it? i have the same after updating vs.. emulators stopped launching with your same error. – Nick Kovalsky Nov 03 '18 at 19:20
  • Hey Nick, I did solve the problem. My main issue was in my bios but the rest I did it as I mentioned here. – Kayvan Karim Nov 05 '18 at 18:33
  • @NickKovalsky, I haven't solved the issue. Looks like an issue in either Microsoft or Google tools. Visual Studio team said they'll investigate it, but it isn't their priority. – TheBlueSky Nov 19 '18 at 15:37
  • @TheBlueSky, did you ever get to the bottom of this since your last comment in November? I have the same scenario as you because I am also running Docker. +1. – w0051977 Jun 17 '19 at 06:49
  • @w0051977, nothing happened. I pinged a couple of people here and on Twitter, also commented on a Visual Studio [issue](https://developercommunity.visualstudio.com/content/problem/313377/android-device-manager-thinks-whpx-is-not-properly.html), but got nothing at all. – TheBlueSky Jun 18 '19 at 15:34
  • @TheBlueSky, do you see any of the Emulators when you install and run this: https://visualstudio.microsoft.com/vs/msft-android-emulator/ – w0051977 Jun 18 '19 at 15:38
  • I wander if your CPU only supports API version 19 or less. – w0051977 Jun 18 '19 at 15:38
  • @w0051977, with Visual Studio Emulator for Android, I have all sort of profiles; they range from API version 17 to version 23. To be sure, I started 2 of them right now, one is version 19 and the other is version 23, and they started successfully. – TheBlueSky Jun 19 '19 at 16:21
  • Have a look here: https://stackoverflow.com/questions/21074535/no-option-to-enable-hyper-v-in-my-bios-settings/21074680#21074680. The answerer talks about VT-x. Have you tried running the CPU-Z tool to see if your CPU support VT-x? – w0051977 Aug 22 '19 at 09:51
4

Running from VS2019 gives me the same WHPX error. But running manually works just fine with hardware acceleration (make sure you run powershell as administrator):

PS C:\Program Files (x86)\Android\android-sdk\emulator> .\emulator.exe -avd <avd_name> -feature WindowsHypervisorPlatform

Tenek
  • 437
  • 1
  • 6
  • 15
  • This doesn't work in my case. When I run this command I get "Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release." As per Intel specs page, my CPU support ETP. – TheBlueSky Dec 05 '19 at 21:19
  • It's the only solution that work in my case, thank you ! – Shuyuntake Feb 26 '20 at 16:39
1

I received this error even though I was already successfully running docker containers as well.

It turns out that I didn't have Windows Hypervisor Platform enabled in the "Turn Windows Features On and Off" menu. Once I turned it on, the error disappeared.

I had both Hyper-V options enabled but not Windows Hypervisor Platform. I guess that one is not required to run docker containers.

0

Work with visual studio 2019

I fixed this issue by disabling "Windows Hypervisor Platform" and only enable "Hyper-V" option.

M. Hamza Rajput
  • 7,810
  • 2
  • 41
  • 36
0

It may be that your CPU does not support virtualization or some other software is preventing its use. If you have an Intel Processor Intel's VTx support page is an excellent resource to determine if your CPU permits virtualization and/or if some other software is preventing its use:

In summary:

  1. Identify Your Intel CPU and View the Specs
  2. Use the Intel Processor Identification Utility (https://www.intel.com/content/www/us/en/support/articles/000005495.html).
  3. As the first link points out, even if the Intel tool in #2 shows VTx not supported, check TaskManager to see if Virtualization is enabled. If it is, then some other software is using Virtualization and preventing the tool (and other tools similar to it) from showing Virtualization as enabled.
  4. Using both Intel's utility and TaskManager you can diagnose the problem per Intel's Table:

Virtualization Checked in Intel Utility + Virtualization Enabled in TaskManager -> enabled, usable

Virtualization Checked in Utility + Virtualization Disabled in TaskManager -> disabled in BIOS.

Virtualization Checked in Utility + Virtualization Enabled in TaskManager -> enabled but used by other software

Virtualization Checked in Utility + Virtualization Disabled in TaskManager -> Virtualization not supported .

CoderBlue
  • 695
  • 7
  • 14
  • Appreciate that you took the time to answer the question, but I guess you missed the part about "I run Hyper-V virtual machines and Docker containers on the same PC" which means my CPU supports visualisation and I use it. – TheBlueSky Mar 13 '21 at 17:46