HAXM installation issues: VS2107+Xamarin - android

In the SDK Manager, I see that HAXM installer isn't compatible with Windows for some reason. Refer screenshot:
I am using Xamarin with VS2017 Enterprise. I have disabled Secure Boot from my BIOS settings and Virtualization is enabled. It's a W530 laptop, with 16 gig RAM and 1 TB HDD on Windows 10. I downloaded haxm-windows_v6_2_1.zip (6.2.1) from here: https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm and when I run intelhaxm-android.exe, it throw this error:
The emulator is an x86 phone and not an ARM one, as, apparently, the former is 10 times more faster (It throws that message). The skeletal project build with no issues
so I know the Android APIs are all correctly set with the target framework version. So when I select my custom emulator (x86 - API 25), in seconds, a deployment error is thrown:
The Output for Build shows this:
1>Starting deploy x86_API25 ...
1>Starting emulator x86_API25 ...
1>C:\PROGRA~2\Android\ANDROI~1\tools\emulator.EXE -partition-size 512 -no-boot-anim -avd x86_API25 -prop monodroid.avdname=x86_API25
1>emulator: ERROR: x86 emulation currently requires hardware acceleration!
1>Please ensure Intel HAXM is properly installed and usable.
1>CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
1>Emulator x86_API25 cannot be started.
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
And yes, Hyper-V IS disabled! It was done from the Command Line in Admin mode!
I have done what ever I did only after scanning the entire Stack Overflow site (and couple of other websites) so yes, I have done my homework.
Please help!
Turn Windows feature on or off:

Related

Emulator: emulator: ERROR: x86_64 emulation currently requires hardware acceleration

When I try to run my Hello application , the emulator gives this message. What is the sulotion?
This is the emulator view unfortunately.
Error
31/08/2018
16:32 Gradle sync started
16:32 Project setup started
16:32 Gradle sync finished in 3s 187ms (from cached state)
16:34 IDE and Plugin Updates: Android Studio is ready to update.
16:35 * daemon not running; starting now at tcp:5037
16:35 * daemon started successfully
16:35 Executing tasks: [:app:assembleDebug]
16:35 Emulator: emulator: ERROR: x86_64 emulation currently requires
hardware acceleration!
16:35 Emulator: Process finished with exit code 1
16:35 Gradle build finished in 27s 847ms
Boot into bios and enable VTX. This allows the emulator to use hardware virtualization.
As can be seen in your error-output, running an emulator x86_64 emulation currently requires hardware acceleration!.
What does this error mean/where does it come from?
Emulations run in a virtualized thread of your CPU. A CPU normaly got several physical cores (e.g. in QuadCore CPUs there are 4 physical cores). Virtualization furthermore subdivides these cores into multiple "virtual" cores, meaning it simulates more phyisical cores. You can read more information elsewhere on the internet. Here an extract from geek-university which sums it up pretty short to the point:
CPU virtualization involves a single CPU acting as if it were multiple
separate CPUs. The most common reason for doing this is to run multiple different operating systems on one machine. CPU
virtualization emphasizes performance and runs directly on the
available CPUs whenever possible. The underlying physical resources
are used whenever possible and the virtualization layer runs
instructions only as needed to make virtual machines operate as if
they were running directly on a physical machine.
When many virtual machines are running [...], those [...]
might compete for CPU resources. [...].
Emulators need this environment due to the highlighted reason: Its emulating an entire other system - In your case an Android smartphone.
Solution
Regarding you have an Intel-CPU (AMD should be somehow analog), this should solve your problem.
As general note (this seems to be solved in OPs question since its not in the error log): Make sure Intel x86 Emulator Accelerator (HAXM installer) is installed in your Android SDK (check under Settings -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools)
Also as note if somebody wants to check if he has OPs problem coming from a more generic error: Run this command in the command line (needs Android SDK Command-line Tools (latest) to be installed in your SDK):
C:\Android\YourApp> C:\Users\{Username}\AppData\Local\Android\Sdk\emulator\emulator.exe -avd YourAVDName -netspeed full -netdelay none
# The First is your path to your SDKs emulator.exe; use the path you installed the SDK in
# -avd needs a name of an existing AVD you set up in the AVD Manager in Android Studio.
The possible outcome is (if HAXM is already installed and hardware acceleration is your poblem):
emulator: Android emulator version 30.5.3.0 (build_id 7196367)
(CL:N/A) handleCpuAcceleration: feature check for hvf emulator: ERROR:
x86_64 emulation currently requires hardware acceleration! CPU
acceleration status: VT feature disabled in BIOS/UEFI More info on
configuring VM acceleration on Windows:
https://developer.android.com/studio/run/emulator-acceleration#vm-windows
General information on acceleration:
https://developer.android.com/studio/run/emulator-acceleration.
Note that I used an AVD with x86_64 here.
To solve the error you have to restart your PC and enter your BIOS. Search for you CPU-preferences (can often be found in an Advanced-options tab). Somewhere there you'll find a setting called Intel Virtualization Technology which presumably is disabled. enable and restart your computer.
Now your AVD should work fine.

Unable to run Android Emulator using WHPX on Azure VM

I following the guide here:
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin
to run Android Emulator using Windows Hypervisor Technology. I'm currently working on Azure VM D_v3 series. During debug my sample app, I've got this error:
2>emulator: CPU Acceleration: DISABLED
2>emulator: CPU Acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
2>emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
2>Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable.
2>CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
WHPX is for sure enabled in Windows Features. Have any idea? Is it possible with azure?
Try disabling OpenGL. It worked for me in a DSv3 VM.
It can be disabled by going to Program Files (or Program Files x86 if you're on a 64-bit machine)\Microsoft XDE\10.0.10586.0\SKUs\Android\xdesku.xml and deleting this line: GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay".
If there are multiple versions under xde, pls identify which version has SKUs\Android.
Ref:
https://social.msdn.microsoft.com/Forums/en-US/d7c0bbc5-eb29-4080-8398-e55111d98c91/vs-android-emulator-cannot-boot?forum=visualstudiogeneral
Today's version of Azure VM may not have full nested virtualization capabilities enabled which may not allow Android emulator on Azure. Dsv3 or Esv3 version machines only have nested virtualization enabled. I tried and could not run Android emulator. While for now you can use Visual Studio Emulator for Android [older version of Android API]on Azure VM. Refer details for step by step guide - https://www.sanganakauthority.com/2020/04/run-android-emulator-and-android-studio.html

Can't start Android emulator after installing Windows 10 Anniversary update

I just installed the Windows 10 anniversary update and now I can't start my Android emulators.
Android Studio shows the following message.
Android Emulator is incompatible with Hyper-V
But as you can see in the following image, Hyper-V is disabled.
I already rebooted the machine. I also tried running the following command from an elevated command prompt:
bcdedit /set hypervisorlaunchtype off
No luck.
Tried launching the emulator from a command prompt fails with the following message:
emulator -avd Nexus_5_API_23
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
Has anyone run into this issue?
The problem in my case is that I had Credential Guard and Virtualization Based Security.
I disabled the mentioned Windows 10 features using Device Guard and Credential Guard hardware readiness tool.
Unzip the tool, in a Powershell command go to the folder where you unzipped the tool and type:
DG_Readiness_Tool_v2.0.ps1 -Disable
After rebooting I was able to reinstall HAXM and start my emulators.
You can turn off Hyper-V in the services menu (type "Services" in the Search thingy), and also use the Services menu to turn it back on. Even though it may not be necessary I still reboot after doing it this way.
EDIT: And also did you run Command Prompt as Admin?
EDIT2: Reinstall Intel HAXM, as #Morrison_Chang says

How to find out if Android Studio is actually using the Intel HAXM accelerator?

I have Intel HAXM installed on my machine along with Atom image. When I fire-up emulator in Android Studio, don't see anything that would tell me if Intel HAXM is being utilized or not.
According to the screenshots on Intel's website, in Starting Android Emulation window in Eclipse, it show a message, informing that Intel HAXM is being utilized.
If your emulator is running with HAXM, you'll see output like this in your run console in Android Studio, with the relevant line being the "HAX is working" bit:
Waiting for device.
/Users/sbarta/sdk/tools/emulator -avd x86-API10 -netspeed full -netdelay none
HAX is working and emulator runs in fast virt mode
Device connected: emulator-5554
Or, according to Intel's official Installation Instructions for Intel® Hardware Accelerated Execution Manager:
To verify that Intel HAXM is running, open a Command Prompt window with administrator privileges (Run as Administrator) and execute the following command:
sc query intelhaxm
If Intel HAXM is working, the command will show a status message indicating that the state is: "4 RUNNING".
According to the Android Studio documentation you can run the following:
$ ./sdk/emulator/emulator -accel-check
And if you see the following you have it installed:
accel:
0
HAXM version 6.0.3 (3) is installed and usable.
accel
It's really easy. just open cmd and do what I did base on below image:
If you see the response like mine, it means that the Haxm is working.
If not running, make sure your processor is capable of running Intel HAXM. You must have VT and ND (aka nx no execute bit) ON in BIOS. (You can read out the nx bit from running bcdedit as admin). But you can't have certain other VT items running (including Hyper-V or VirtualBox).
There's an article on troubleshooting Intel HAXM at software.intel.com (search on HAXM).

Android emulator: how to find out if hardware virtualization feature is used?

Starting with Android SDK Tools rev 17 the Android emulator supports using the hardware virtualization feature (Intel VT, VT-x, vmx and AMD-V, SVM) which should speed-up x86 based emulator images a lot: http://developer.android.com/guide/developing/devices/emulator.html#accel-vm
I installed all necessary components:
The newest SDK tools
The Intel Hardware Accelerated Execution Manager (and installed it by executing IntelHaxm.exe)
Intel Atom x86 System Image (available as API 10 and API 15 image)
Then I created a new AVD using that image, but I could not "feel" any difference regarding the execution speed.
Therefore my question is: How to find out if hardware virtualization feature is used?
And if not what needs to be done to use it?
I know that it is enabled by the BIOS, because I can run Windows 64 bit VMs in VirtualBox.
Additionally I have verified it using the Microsoft® Hardware-Assisted Virtualization Detection Tool.
During emulator loading you should see this line:
[2012-03-26 14:06:22 - Emulator] HAX is working and emulator runs in fast virt mode
After steping through this tutorial on OS X Lion, I see the following in the console, when starting the emulator:
./emulator-x86 -avd Test3
HAX is working and emulator runs in fast virt mode
Had the same issue on Windows 7 32bit with Q6600 Intel processor and pretty outdated Asus P5E-VM SE motherboard.
The motherboard did not even have a switch for virtualization, though Intel tool:
http://www.intel.com/support/processors/tools/piu/sb/CS-014921.htm
indicated that VT technology is enabled.
The culprit was that Data Execution prevention was enabled only for windows services, I have enabled it for all programs and after computer restart received this message in the Android Console of the Eclipse:
HAX is working and emulator runs in fast virt mode
DEP setting is located:
Located Windows/Control Panel/System&Security/System/Advanced System Settings/Advanced tab/Performance/Data Execution Prevention tab
The idea to check it I received here: https://developer.tizen.org/sdk/haxm
Though only used standard images (not Tizen ones).
Have to say that loading of the emulator in the virtualization mode is not nearly as impressive as on Intel promo video: http://www.youtube.com/watch?v=pt9IeJ777zw
But uploading of the application (mine is pretty big ~5MB) and general responsiveness of the emulator is quite significant. One cannot say that it works as native computer (that it sometimes there is a visible lag), but again it is visibly faster.
It eats a lot of memory though (I have 4 GB, only 14MB is free when emulator will run).
A quick solution for Windows platform, Launch CMD as an administrator and type this command
SC query INTELHAXM
And you should see output like this (if hardware acceleration is up and running)
SERVICE_NAME: intelhaxm
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

Categories

Resources