Facing Android Studio Emulator Error with AMD CPU [2021] - windows

You open Android Studio as always, but if you would like to run an emulator device one of the following error appear:
Unable to install Android Emulator Hypervisor Driver for AMD
Processors
or
Intel HAXM is required to run this AVD.
Android Emulator Hypervisor
Driver for AMD Processor is not installed.
or later in cmd or Powershell
[SC] DeleteService succeed. Fail of [SC] StartService error 4294967201

INTRODUCTION
First of all, I know that there are some posts out there. But there not up to date or incomplete.
I want to point that my intention with this post is to make a nearly 100% working knowledge base for this issue. Serving as a step by step tutorial for fixing that problem properly.
Don't panic, we will fix that now :)
CHECK-1:
Check your BIOS Settings first. Virtualization Technology needs to be enabled in BIOS.
Gigabyte, Asus Rog or MSI for example call that SVM Mode ("Secure Virtual Machine") other may call that as mentioned: "Virtualization"
F2/Del to access BIOS -> Advanced Settings -> CPU Configuration -> SVM Mode -> Enable, safe that with F10 (Asus BIOS Example)
As BIOS options are different among vendors, please refer to your system manufacturer's manual.
CHECK-2:
Type in your Windows searchbar (Lower left corner) "Windows Features".
Make sure Hyper-V and Windows Hypervisor Platform are disabled. All Windows features enabling Hyper-V either explicitly or silently must be turned off. Restart your computer after. See the screenshots below for what you need to uncheck:
Note that in a future Studio 4.0 release, these instructions will be automatically run as part of the SDK Manager update and become obsolete.
CHECK-3:
To really ensure that Hyper-V is disabled run following command in Powershell.
Open powershell: Right click on your Windows Logo (Lower left corner) -> click Windows Powershell (Administrator) -> proceed with following command:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V
SETUP ANDROID STUDIO
We now want to install the missing Hypervisor Driver for AMD Processors:
In Android Studio navigate File -> Settings -> expand Appearance & Behavior -> expand System Settings -> Android SDK -> SDK Tools -> install Android Emulator Hypervisor Driver for AMD Processors (installer) -> Apply -> OK
RUN THE INSTALLER
Now you downloaded the package of the driver you need to find it's location.
In the image below you see the path of your Android SDK's.
Copy that path into your Explorer and navigate through like in image below to your silent_install.bat
Copy the complete path of your explorer and run Powershell as Administrator (how to open, explained above). In Powershell type:
cd [here your copied path]
Afterwards execute your installer by typing:
.\silent_install.bat
You will probably get an error, but that isn't important, because the installer worked. We will see it later. The service only couldn't start because one of our 3 CHECKS above are not done properly.
Then it will look something like that:
We use this "worst case" to proof that the installer operated sucessfully even with the following errors.
[SC] DeleteService succeed. Fail of [SC] StartService error 4294967201
They may lead you to a github directory. To download a code there, but it isn't necessary at all. It worked already. Let's try it out.
PS: If everything went as it should it will look like that (Best case):
CREATING EMULATOR DEVICE
Let's create an android device and test it. I made it step by step as shown in the screenshots:
After you selected a device you are finally able to download the android version of the device:
Make your unique settings:
Run your device:
FINAL & CONCLUSION
Now you are able to work with the android studio emulator and an AMD Processor. Congratz! :)
I know it was a long tutorial, but you made it trough.
If you face any issues, comment below, I try to help you!
That was it once again from my side. I keep this post updated.

Related

TwinCAT Realtime Startup of isolated CPU Fails

I am currently running Twincat 3.1..4022.16 on Hyper V virtual machine.
I am able to correctly build my project but when activating configuration I am getting realtime startup isolated cpu fail.
Attached is my Realtime setting and the error.
Any leads to solution will be highly appreciated.
I got the following errors when trying to activate my configuration using TwinCAT 4024.10.
Severity
Description
Error
'TwinCAT System' (10000): Sending ams command >> Init4\RTime: Start Interrupt: Ticker started >> AdsError: 4132 (0x1024, RTIME: incompatible software detected) << failed!
Error
'TCRTIME' (200): start of real-time avoided by "HyperV"
Solution
The issue was caused by the fact that I had earlier tried to get Docker working on my laptop. In order to get Docker to work I had to enable a bunch of Hypervisor options. After realizing this I reverted these by doing the following:
Press the windows key and start typing "Turn Windows features on or off"
In the following menu, make sure "Virtual Machine Platform" and "Windows Hypervisor Platform" are deselected. In case either option was selected, deselect it and restart your computer for it to take effect.
I found this on the Beckhoff website:
The runtime environment cannot be started inside a Hyper-V
environment. This refers in particular to virtual Hyper-V machines,
which are run in a privileged Hyper-V machine. As soon as a component
of the computer uses Hyper-V, only the engineering environment (XAE)
can be used on this computer, not the runtime environment (XAR). Apart
from software solutions for virtual machines, you can also use
operating system means (Device Guard, Credential Guard,
virtualization-based security, etc.) or other Hyper-V programs.
Link
Read available number of CPUs from the Target, then change number of Isolated Cores from 0 to any higher number (most cases 1) and decrease number of Cores that are dedicated to Windows.
After that click Set on target.
Here's link to detailed article about Twincat and Virtualization
alltwincat.com/2018/06/14/twincat-virtualization/
This is a supplement to Roald's answer.
If you already deactivated Virtual Machine Platform, Windows Hypervisor Platform and Microsoft Defender Platform Guard and still doesn't work, chances are you have virtualization-based security enabled. You can check it by typing msinfo on windows search box.
To deactivate it, type Core Isolation on the windows search box and deactivate Memory Integrity. Restart the machine and run ms info again to make sure that VBS is off.
Go to Twincat, activate your project and witness a miracle!
If none of the above solutions worked, try to uncheck the below settings in Windows 11:
Privacy & security > Windows security > device security > core isolation > memory integrity >> off
Supplement to Felipe's and Roald's answer: latest offender prohibiting TwinCAT from starting is yet another virtualization feature: Windows Sandbox. Can be turned toggled in the Windows Features dialog accessible from Start->Turn Windows features on or off.

can not debug windows driver via net

I am using VS 2015 to learn windows driver development.code & compile are ok.
But i can not debug on target machine via net.
here are the output of vs:
----------------------------------------------------------------
[22:12:32:074]: Gathering kernel debugger settings
[22:12:32:080]: Removing any existing files from test execution folder.
[22:12:32:446]: Copying required files for "Gathering kernel debugger settings".
[22:12:37:967]: [Gathering kernel debugger settings] Command Line:
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"#Name='DriverTestTasks::_LogDebuggerSettings'" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Gathering_kernel_debugger_settings_00013.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[22:12:41:624]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[22:12:41:624]: Task "Gathering kernel debugger settings" completed successfully
-------------------------------------------------------------------------
then i got a alert:
"failed to create process instance prevents debugging"
and then nothing happens.
what can i do to debug my driver on target machine?
Thanks a lot!
Visual Studio for remote kernel-mode debugging of your own device driver can be a huge pain sometimes; I've seen many experienced kernel-mode engineers stop wasting their time trying to get it to work in the past.
Make sure that you have the same version of Windows Driver Kit (WDK) installed on the Target Machine as you have installed on the Host Machine. Then try again and see if that solves the problem. You also need to make sure that you're signed into the WDK User Account which is automatically created at the start of Target Machine provisioning, as well as Debug Mode being enabled from boot.
If you cannot get it working properly after maximum a week, you may as well not bother wasting your time even further. You can use WinDbg (comes with the Windows Driver Kit as part of Debugging Tools - Visual Studio uses the WinDbg engine for debugging) to remotely debug the kernel of the Target Machine, and you can also use this for setting break-points/analysis of your own device driver. You'll just have to compile your source code and copy across your compiled driver/s to the Target Machine each time manually, which isn't all that bad thanks to shared folder features over a network/virtual machine.

Unable to create the virtual machine

I was so happy today that I have been finally able to install Windows Phone 8 SDK and try it a bit. I installed fresh new installation of Windows 8 Pro into my virtual machine (I am running if from Parallels) and then installed Windows Phone 8 SDK.
Everything went smooth, Visual Studio Express is installed and running, but when I created new project and tried to deploy it, VS fails with really weird message.
First of all, message box informing that "The Windows Phone Emulator wasn't able to create the virtual machine: Generic failure" appears. Really informing, really professional - generic error, that's really good. Then the information that deployment failed appears (thanks a lot for keeping me informed about that, I didn't noticed that it crashed completely). And then in the Error List, there is an information about "Invalid pointer" - even better. No clue at all about what failed or what's wrong.
Can anybody help me with that? There is nothing on the internet about this topic so far and I don't know where the problem is. I scanned the Windows events and logs, but there is nothing (probably I haven't been searching properly, so please guide me through that if you can).
Anybody can help?
The Windows Phone 8 emulator requires hardware Hyper-V support. In particular, it requires second-level address translation, hardware assisted virtualization, and hardware DEP support enabled and to not be ran in a hypervisor(no nesting). If you bought your machine within the past 4 years you should have no problem with these requirements. You can check out this article to see more information about that and how to find if your PC supports it.
Because of these hardware requirements, this means you can't run the phone emulator inside of most virtualization technologies... With one exception: I've been using VMWare 9 which appears to include an "unsupported" feature to allow Hyper-V to work though.. So your only choice for running the phone emulator is to either buy VMWare 9 (or 8 with more configuration) or upgrade a physical machine to Windows 8
The unsupported way VMWare allows you to run Hyper-V inside of a VM is that there is a manual option (hypervisor.cpuid.v0 = “FALSE”) which basically tells VMWare not to report to the virtual machine that it's running in a VM. Hyper-V checks if it's running in a VM and won't work if it is, so this gets Hyper-V to work past that check. I personally have tested this whole nested-VM thing with the Phone emulator(including before public release), and other than being quite slow, it does work pretty well with no immediate crashes or anything.
There is a workaround for VMWare Workstation 8 as well in an answer below. However, 9 is much easier to configure, so if you have it use this method.
I ran into the same issue and I fixed it by enabling Hypervisor applications in this virtual machine and adding the following line to the .vmx file:
hypervisor.cpuid.v0 = "FALSE"
This got the emulator working just fine. I found this answer here.
Hope this helps.
Actually, it works quite nicely with VMware Fusion 5.0.1
All I had to do is to add to the .vmx file of the virtual machine the following lines:
hypervisor.cpuid.v0 = “FALSE”
vhv.enable = "true"
Save and restart VMWARE (obviously the VM must be stopped before the changes are made)
I'm right now debugging a test app from VS2012 using the emaulator inside a VM in my Macbook
I'm a happy camper
:-)
I posted the same question on Parallels forum.
Reply:
The emulator is actually a virtual machine, so we are talking about a vm inside a vm, this requires support for nested Hyper-V, which afaik is planned but not implemented yet, also VMWare Fusion already supports this, if you are so desperate.
————-
See Parallels forum post: http://forum.parallels.com/showthread.php?p=646448#post646448
This works for me
Set RAM to 4g
Set at least 2 cores
add to vmx file.
vhv.enable = "TRUE"
hypervisor.cpuid.v0="FALSE"
Goot article
http://social.msdn.microsoft.com/Forums/en-US/wptools/thread/ed72010c-321c-4667-97b2-3ff1540e7f87/
You need SLAT compatible hardware to run Hyper-V, which is a requirement for using the emulator.
Can you clarify what kind of hardware you're attempting to run this on, and if you have enabled Virtualization in your BIOS settings?
The "Invalid pointer" error just means it cannot connect to the emulator (and/or device).
Just as an addition to https://stackoverflow.com/a/13163762/1964969 (top answer at the moment):
manually appending "hypervisor.cpuid.v0" key works for VmWare Player 5 as well (the main reason - this software is free for non-commercial use so it's perfect product if you test the waters, just download from VmWare website and install, it's fully-functional).
Slightly unexpected, any of the following amends solve the problem with WP8 emulator:
hypervisor.cpuid.v0="FALSE"
hypervisor.cpuid.v0="TRUE"
hypervisor.cpuid.v0=""
Yeah, you can apply empty value for that key - but why? Have no idea but it works. I did some notes in my blog as well:
http://windowsasusual.blogspot.ru/2013/01/how-to-launch-windows-phone-8-emulator.html
Under Parallels Desktop 8 follow this guide: http://kb.parallels.com/en/115211
Edit:
Oh, I didn't noticed that you are trying to run emulator on VM. My answer is for non-VM environment.
First of all, you need to check hardware requirement at here
Be careful, successful installation of SDK does not guarantee "your hardware is compatible"
If your hardware is compatible and Hyper-V is running(described in the link above), please check your BIOS and be sure to enable hardware virtualization in CPU Configuration
(for me, I could find it at Booting > BIOS > Advanced > Advanced > CPU Configuration)
Brief summary:
64bit CPU and OS
4GB RAM
Hardware-assisted virtualization supported CPU
Second Level Address Translation (SLAT) supported hardware
Hardware-based Data Execution Prevention (DEP) supported hardware
Proper BIOS settings
For me the solution adding line:
hypervisor.cpuid.v0 = "FALSE"
I use VMware Player and added the line (hypervisor.cpuid.v0 = "FALSE")in the .vmx file.
My virtual machine with Windows 8 Pro runs the emulator for Windows Phone 8 perfectly.
Solved the problem by uninstalling an older VPN client from the machine. It turns out some VPN clients might have compatibility issues with Windows 8. After uninstalling VPN client I was able to run the emulator without issues (of course after making sure Hyper-V was installed and enabled on the machine)
Not enough rep. to comment on the accepted answer, but Microsoft provide instructions specifically for Fusion here. It worked for me, after a couple of reboots of both Mac and VM. I installed W8.1 without Hyper-V support initially and had to install it after the fact ("Turn Windows Features On or Off" in Control Panel), but apart from that no problems. Quite speedy on a 16Gb 2013 MBP.

Old 16-bit Application Causing GPF in WIN87EM.DLL, intermittently

I've got an old 16-bit application, that was developed for Windows 3.1. It preforms some calculations and is part of a more complex system. The system sets up the inputs for the program, and collects the output results.
Unfortunately, the 16-bit program is here to stay for the mean time, so we have to work around the frustrations it causes on modern operating systems.
The system runs on Windows XP, and on physical Windows XP machines it runs alright. The machine I'm having a problem with, is a Windows XP instance running on VirtualBox (version 4.1.12) on a Debian box. The physical computer is an HP Proliant server, with Quad Core Xeon 3.4 Ghz. I'm using remote desktop to access the computer from my Windows 7 box.
The error I'm getting is, "PROGRAM caused a General Protection Fault in WIN87EM.DLL at address : 0001:02C9". The annoying thing is, at times it works and other times it doesn't, making troubleshooting all that more frustrating.
From trawling the internet, I've come across a few sites that mention the same problem. None of them seem to offer real solutions, except to say that WIN87EM.DLL supplies floating point routines, and has some issues with certain printers.
I've uninstalled all printers on the virtual machine, I've also tried installing a PDF writer and setting it as the default printer - so that there is a printer on the machine. I've disabled resource sharing with my Remote Desktop connection. I've updated the Virtual Machine Guest drivers on the machine. I've also tried setting the compatibility to Windows 95 in the properties of the executable.
Any pointers for troubleshooting this problem, or methods I could try to get it working?
This question is old but I had this exact win87em.dll crash with some 16-bit factory automation software running natively on windows 7. By following the method of HIDE87.com and editing autoexec.nt I was able to make the software stop crashing so that I could make edits.
This machine was running Intel 8 Series/C220 Series chips. I attribute this configuration to the crash because I have used this same 16-bit software on tons of other windows 7 machines for years now.
edit: here's the steps I used to fix the problem
Download winfloat.exe from http://www.conradshome.com/win31/archive/
Open winfloat.exe with 7zip. Find HIDE87.com and extract it to desktop.
Copy HIDE87.com to C:\Windows\System32\
Open c:\windows\system32\autoexec.nt with notepad
At top of file, after first group of comments add the following
lh %SystemRoot%\system32\HIDE87.com
Add a comment above your last line
REM Fix for Gen. Protection Fault in win87em.dll
Save changes to autoexec.nt and reboot pc.
This was the same error I had with Microsoft XP Mode.
Obviously WIN87EM.DLL has Problems with virtualized processors.
My Solution: I "unloaded" the XP-Version of WIN87EM.DLL in the registry (search and delete every item with this name), and copied a much older version into application folder. The old version can be found her: http://support.microsoft.com/kb/86869/de
Good luck!
Video Driver win87em.dll
This is the step by step resolution to the problem we had with the “win87em.dll” issue.
Left-Click the START button in the bottom left corner of the screen.
Right-Click My Computer and left click Properties.
Left-Click the tab at the top that says Hardware
Left-Click the button that says Device Manager.
Left-Click the + sign next to Display Adapters near the top of the list.
Right-Click the items shown in the expanded list under Display Adapters and left-click Disable.
Left-Click the Yes button that shows when windows asks if you are sure you want to disable it.
Left-Click the No button when windows asks if you want to reboot.
Repeat the disable process for each item listed under Display Adapters (usually only one or two)
Reboot the PC and the win87em.dll General Protection Fault errors should go away.
This is only applicable for users on Windows XP. Most likely the display adapters listed will be shown as an Intel G41 internal display adapter, but it may be another Intel device. If this does not fix the issue then it is likely a bad printer driver causing the problem.
Disabling the video adapter will not hurt windows. It will make their computer unable to watch videos or play 3D games, but windows will still run and look fine. (They will probably need to change their screen resolution after rebooting.)
VirtualBox 4.3.16 should also have a fix. See https://www.virtualbox.org/ticket/12646 If you want the fix immediately, you'll have to build VirtualBox from OSE sources.
Update: VirtualBox 4.3.16 containing this fix is now officially released.
I know this is an old thread but I came across it while searching as I was having the same issue under Windows XP running VirtualBox. Eventually I found the following:
https://communities.vmware.com/people/jmattson/blog/2012/03
This is for VMWare and seems to have fixed the issue, couldn't find anything similar for VirtualBox but as VMWare Player is free it is a good workaround for anyone having this problem.
in the case of virtual machines - vxBOX (tested) of VM ware (maybe)
you just have to switch off all para virtualization options in the processors section of VX BOX options.
works like magic!

Upgrading driver from XP to W7

I've got a driver for a custom PCI card, which builds and runs fine on XP. I'm trying to use this custom hardware on W7, and am trying to build and run my driver.
I've got the latest DDK from Microsoft, and build my driver for XP using Windows XP "x86 Free Build Environment". Everything installs & works fine. (Build using a DDK "build" command)
If I use the Windows 7 "x86 Free Build Environment" build environment, everything builds fine. I run it through the PREfast and staticdv code checkers, no errors from either. ( I get a couple of warnings about "The dispatch function 'FooFnc' does not have any __drv_dispatchType annotations" - are these likely to be the issue? )
When I install, the install starts OK (standard error about drivers not being signed), but gets to a certain point and then hangs, then fails with a timeout error. The device then shows up in device manager as installed. At this point the PC won't shutdown or boot, but hangs indefinitely. I'm forced to boot into Safe Mode and uninstall the driver from there.
So my question(s) are:
If there has been a change in the driver model between XP and W7, what's the best way to find it? I can't see anything on MSDN.
How would I go about debugging the driver? The box doesn't start, so it's not like I can run up WinDBG.
Any specific W7 driver gotchas that are hidden away?
I've tried to keep this as generic as possible, but if more detail would be helpful I'll provide more
AFAIK, the biggest changes have been made in video and network drivers. Other drivers retain backward compatibility and can be run on W7 even with no recompiling.
Run your driver under driver verifier and turn on generating crash dumps with a keyboard (very helpful in case of system hangs, you can manually generate crashdump, analyze it and find what was wrong).
Hope this helps!

Resources