Android Studio Emulator: WHPX: failed to enable partition - android

I am trying to get the Android Emulator to work with my Ryzen 2700X CPU but I always get the following error:
Emulator: qemu-system-x86_64.exe: WHPX: Failed to enable partition extended X64MsrExit and X64CpuidExit hr=80070057
Emulator: qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument.
I made sure the latest Emulator version is installed and Windows Hypervisor, Hyper-V and virtualization in BIOS are all enabled.
I searched for answers for a while but could not find any solution to this problem.
EDIT:
After deleting the Nexus5X device and re-creating it with Pie x86 it worked fine. Make sure to check the following:
activate Visualization in your BIOS (SVM Mode)
Android Studio and Emulator are up-to-date
Windows Hypervisor and Hyper-V-Hypervisor in Windows Features are activated (uncheck Hyper-V-Services)
run Android Studio as Administrator

I think you've done all the setups well.
but
Do you use Windows 1903 version?
That version has an issue for Ryzen CPU Virtualization.
as a solution
You can update the Windows version
Or Revert to the previous version.
Or you can update it to a preview version.

Related

Android Emulator Error missing WinHvPlatform.dll

today, suddendly, all my Android Emulators (on Win10 / IntelliJ IDEA),
started complaining about a missing library.
When i launch any emulator, during loading, i read on the console log:
Emulator: Could not load library 'WinHvPlatform.dll'
then, the emulator starts and seems to run OK.
But... does anyone have an idea what it could be the cause ?
What is that library ?
It's because Microsoft has worked with Google to allow using Hyper-V instead of Intel HAXM as hypervisor. See these articles:
https://blogs.msdn.microsoft.com/visualstudio/2018/05/08/hyper-v-android-emulator-support/
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration
The Windows Hypervisor Platform was introduced in the Windows 10 April
2018 Update and enables third-party virtualization stacks to utilize
the Windows Hypervisor for hardware acceleration. If you are using
Hyper-V, this stack replaces Intel HAXM as the hypervisor for the
Android emulator.
If you run the ANDROID_SDK\emulator\emulator.exe -avd YOURAVD -verbose you might get this output:
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: DISABLED
emulator: CPU Acceleration status: HAXM is not installed on this machine
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
You could follow the instructions in the above posts to turn off Windows Hypervisor for Google's Android emulator in %USERPROFILE%\.android\advancedFeatures.ini by setting:
WindowsHypervisorPlatform=off
Hyper-V should be disabled for the Android emulators, and use Intel HAXM instead (if your processor supports it). Also make sure you are using the updated Android SDK 27 tools and emulators, they can be updated as explained in this article.

Android Studio not launching an emulator

When i am trying to run Android code in Android Studio it shows the following in the event log. But I'm not getting any output and am unable to open the emulator.
Executing tasks: [:app:assembleDebug, :app:assembleDebugAndroidTest]
7:28:43 PM Gradle build finished in 4s 386ms
7:30:24 PM Executing tasks: [:app:assembleDebug]
7:30:27 PM Gradle build finished in 3s 576ms
When I am trying to run from AVD Manager it shows as follows:
Cannot launch AVD in emulator.
Output:
emulator: WARNING: VM heap size set below hardware specified minimum of 384MB
emulator: WARNING: Setting VM heap size to 384MB
emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: Android Emulator requires an Intel processor with VT-x and NX support.
Your CPU: 'AuthenticAMD'
When this type of problem happens, best way is to make sure you have followed below points correctly.
You have proper SDK installed
You have Intel HAXM & virtualization option enabled in your BIOS
Configure emulator correctly, download the Intel X86 Atom system image for better performance.
User arm instead of x86 if you have AMD processor when creating emulator.(In most of case)
When you created your device you should have used arm instead of x86. It must work
I'd recommend using Visual Studios Android Emulator
It is stand-alone, so you dont need Visual Studio to run it, it boots up in seconds, and is more robust then GenyMotions Android Emulator.
Launch your emulator from VS Android emulator, once the OS boots and the homescreen displays run your code and it will give you an option to choose the VS emulator in android studio.
Download latest version of Haxm and enable it in bios (hardware acceleration), on most computers it is basically turned off

Cannot launch AVD in emulator. Please ensure Intel HAXM is properly installed and usable [duplicate]

This question already has answers here:
Error in launching AVD with AMD processor
(19 answers)
Closed 6 years ago.
I am getting this error when i tired launching the emulator. Any suggestions?
Cannot launch AVD in emulator.
Output:
emulator: WARNING: VM heap size set below hardware specified minimum of 128MB
emulator: WARNING: Setting VM heap size to 384MB
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAXM must be updated (version 1.1.4 < 6.0.1).
After downloading the Intel HAXM from the android studio, you need to install it. Run the setup from Users*name*\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe
Sadly, this can be installed only on computers with Intel CPU's, so you must have an Intel to run the Android Studio emulator.
Have you tried reinstalling Intel HAXM? To do that follow these steps.
1) Open SDK Manager and Download Intel x86 Emulator Accelerator (HAXM installer) if you haven't.
2) Now go to your SDK directory (C:\users\username\AppData\Local\Android\sdk, generally). In this directory Go to extras > intel > Hardware_Accelerated_Execution_Manager and run the file named "intelhaxm-android.exe".
3) Restart Android Studio and then try to start the AVD again.
It might take a minute or 2 to show the emulator window.
See this link
or this (for Windows, see link for Mac/Linux):
Configuring VM Acceleration on Windows
Virtual machine acceleration for Windows requires the installation of the Intel Hardware Accelerated Execution Manager (Intel HAXM). The software requires an Intel CPU with Virtualization Technology (VT) support and one of the following operating systems:
Windows 7 (32/64-bit)
Windows Vista (32/64-bit)
Windows XP (32-bit only)
To install the virtualization driver:
Start the Android SDK Manager, select Extras and then select Intel Hardware Accelerated Execution Manager.
After the download completes, execute /extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe.
Follow the on-screen instructions to complete installation.
After installation completes, confirm that the virtualization driver is operating correctly by opening a command prompt window and running the following command:
sc query intelhaxm
You should see a status message including the following information:
SERVICE_NAME: intelhaxm
...
STATE : 4 RUNNING
...
To run an x86-based emulator with VM acceleration:
If you are running the emulator from the command line, just specify an x86-based AVD:
emulator -avd
Note: You must provide an x86-based AVD configuration name, otherwise VM acceleration will not be enabled.
If you are running the emulator from Android Studio, run your Android application with an x86-based AVD:
In Android Studio, click your Android project folder and then select Run > Edit Configurations...
In the left panel of the Run/Debug Configurations dialog, select your Android run configuration or create a new configuration.
Under the Target Device options, select the x86-based AVD you created previously.
Run your Android project using this run configuration.
You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running its installer.
You can stop using the virtualization driver by uninstalling it. Re-run the installer or use the Control Panel to remove the software.
You need to have the latest version on intel haxm driver installed. You seem to have version 1.1.4 and the latest one is 6.0.1
Here is the direct link to download and install https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
enable VT-x for your system, get the latest version of haxm here https://github.com/intel/haxm/releases/tag/v7.4.1 update and u are good to go.
(Or you can use the SDK manager to install it like the other answer suggests)

Error in Android Studio: "ERROR: x86 emulation currently requires hardware acceleration!"

I started recently using Android Studio and am stuck with this error message:
x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!
Any idea how to resolve it?
I did some search on the issue am having and I think it has to do with changing my ANDROID_SDK_ROOT environment variable to the original value, but no clue how to do so.
Not resolveable if you have an AMD processor on Windows, at least as far as I know.
If you have an Intel processor, enable the virtual extensions in your bios (called VT, if available).
If you are on windows also install HAXM via the Android SDK manager. (also install it, the SDK manager will only download it: {SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe)
Disable hyper-V if you are on Windows 8 or above using: dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
Genymotion is an alternative for AMD users.
Possible duplicate of Error in launching AVD with AMD processor

Error in launching AVD on Windows 7 Android studio

I am trying to start emulator on newly installed Android Studio but I am getting following error:
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!
I tried to install HAXM from extras but I keep on getting following error:
VT not supported
then I tried this about which I read in another forum:
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
but its also failing with below error:
Deployment Image Servicing and Management tool
Version: 6.1.7600.16385
Image Version: 6.1.7601.18489
Error: 0x800f080c
Feature name Microsoft-Hyper-V is unknown.
A Windows feature name was not recognized.
Use the /Get-Features option to find the name of the feature in the image and try the command again.
Although I checked from BIOS setup that my processor supports VT and its enabled in BIOS.
My system configurations is:
Intel i5 2410,
Windows 4 64-bit,
JDK7,
Android SDK 24.0.1,
Android Studio 1.0.1,
Please help to solve this issue if anyone has been able to solve it earlier.
I had this issue and it was caused by VirtualBox. After uninstalling VB everything worked fine but when I was doing some research about this problem it seemed like other things can generate this error. If you have virtualBox try to uninstall it, if you don't well... sorry, can't help.

Categories

Resources