Search code examples
androidandroid-studioandroid-emulatorandroid-sdk-toolsavd-manager

android studio avd manager invalid option -- '-enable-whpx'


I facing an error while running any emulator with android studio avd manager:

...AppData\Local\Android\Sdk\emulator/emulator-x86.exe: invalid option -- '-enable-whpx' 
  • android studio version is 3.1.3
  • android emulator version is 27.3.9
  • Hyper-V and Windows Hypervisor Platform are active on my windows 10
  • and the WindowsHypervisorPlatform = on flag is set ...sdk\emulator\lib/advancedFeatures.ini

this is a part of verbose mode:

emulator: Checking whether Windows Hypervisor Platform (WHPX) is available.
emulator: Could not load library WinHvPlatform.dll
emulator: WHPX is either not available or not installed.
emulator: CPU Acceleration: working
emulator: CPU Acceleration status: HAXM version 7.2.0 (4) is installed and usable.

Windows Hypervisor Platform is checked in the windows features and the WinHvPlatform.dll is present in C:\Windows\System32

how can i enable or install WHPX ?


Solution

  • My problem solved by simply changing the emulator engine.

    According to documentation you can specify the emulator engine with the -engine flag. the mentioned error occur using the classic engine. when i changed the engine to auto or qemu2 the emulator started with no error. to change the engine go to .../sdk/emulator directory with the command line and run:

    emulator.exe -list-avds
    

    this will output you virtual devices name

    then run:

    emulator.exe -avd YOUR_DEVICE_NAME -engine qemu2
    

    or

    emulator.exe -avd YOUR_DEVICE_NAME -engine auto
    

    I hope this will help you.