I start an x86 Android VM via the Visual Studio Emulator for Android.
If I look at the Hyper-V Manager, I see that the VM is started. I can actually connect to it via Hyper-V, and it loads and works perfectly.
But the emulator (the thing that looks like a phone) is still stuck at "OS is starting..." It doesn't get farther than that, even though the VM is fully loaded!
How do I fix this?
(It's not one of the typical virtual switch problems, as like I say, the VM loads in Hyper-V Manager.)
I highly suspect this is a configuration issue, possibly inside VS. Android Studio provides a more proper way to create a simulator through a very simple wizard. I suggest you use it to create and launch the emulator, VS will detect it as a device and you will be able to launch it directly from there -no config needed-
A way nicer emulator though is Genymotion. It runs as an Oracle VirtualBox virtual machine and is way faster than Google's native emulator
I used the nuclear option: delete switches, delete VMs, uninstall emulator, uninstall Hyper-V, reboot, reinstall HV, reinstall emulator, ensure firewall rules are not blocking it, reboot. Then run emulator again to recreate switches.
Now I have other problems, but this problem is gone. This is a very brittle product.
Related
I would like to run WSL2 with my api in it, and an Android emulator to run my app so I can test said api. WSL2 is working perfectly when I'm having Hyper-V activated. Then I'm trying to use Android Studio's emulator and it just hangs, never launching the emulator.
Now, if I deactivate Hyper-V entirely (in the windows features screen and through bcdedit /set hypervisorlaunchtype off) the emulator does launch perfectly, but of course WSL2 won't work now...
I took a look at lots of the topics around here without success. For example How to run Android emulator on windows while using WSL2 with zsh?, Running React Native in WSL with the emulator running directly in Windows or this tutorial. No success so far.
As said I'm using a Ryzen processor.
I was able to find way around it. I'm running Windows 11 Pro, Update 21H2, OS build 22000.51, AMD.
Here is Google documentation how to setup emulator for AMD processors. It requires Hyper-V and WHPX to be disabled. And that does not go in pair with running WSL2.
My setup is:
Android Studio and IntelliJ running under Windows
Docker, DBs and other services running under Ubuntu (WSL2)
What I did:
Enable Hyper-V and WHPX.
Added new Android VM in Hyper-V Manager like that
Find Android VM IP address (I did so by going to running Android wi-fi options) and use adb connect <ip goes here>:5555
If connected properly, it should appear in Android Studio.
I tried to adb connect to the Android from Ubuntu, but it does not work out of the box. Should be doable with some WSL2 > Host redirects, but I currently do not need it and did not research it any further.
Last thing that bugged me was default Android VM resolution (looks like tablet in horizontal orientation). It is possible to adjust it like that.
We probably need to wait for Google to come up with emulator that uses the same emulation type as WSL2.
Things that do not work/are missing (or I do not know how to do it):
cannot change screen orientation on the fly
software keyboard is not showing up when typing (problem when you need to test your UI with it)
no GPU acceleration in Hyper-V (Microsoft disabled it due to secuirty reasons (?) but there seems to be a way to enable it, have not tried it, for my needs default performance is fine)
So, someone gave a great answer on the issue tracker!
https://issuetracker.google.com/issues/202188690#comment18
Basically, as he says, It's being caused by the XSAVE disable code in the WHPX API integration -- target/i386/whpx-all.c -- commenting out this line appears to make it work:
https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/target/i386/whpx-all.c#1768
In the issuetracker, another user has posted already compiled exe files, if anyone needs it. For me it fixed everything, the emulator is now working perfectly properly.
Just add these extra features in windows and you can then run your emulator within wsl2, remember to chown for dev/kvm to your user.
enter image description here
I have been running Android Studio 1.5.1 doing development on a WMWare copy of Windows 2012 R2 and everything works fine. I've been able to run the device emulator with no problems and start various versions of Android running in AVD.
Android Studio 2.x Change
I recently installed Android Studio 2.0 (see image below for exact version).
Now when I attempt to run the emulator nothing happens.
Well, actually I do see a message in the status bar of Studio when I attempt to start the device, but then that message disappears and nothing happens after that.
There is a warning that I need to turn off Hyper-V (see image below), but I don't believe that is possible since this is a VM.
No Longer Possible?
Is it not possible to run the emulator on the VM any more?
More recent versions of the Android Emulator require hardware virtualization support (Intel HAXM).
Unfortunately, most virtual machines do not provide HAXM instructions to the guest (a VM within a VM), so you will be unable to use the emulator within the virtual machine.
I just installed Android Studio 2.1 on my Windows 2008 R2 VM (running VMWare) and I'm happy to report that it is possible to run ARM based AVD (Android Virtual Devices) on the VM.
Steps To Run Arm-based Virtual Device on VMWare
Go to location where you've installed the Android SDKs (in my case it is at %appdata%\Android2\SDK\
If you are in the right place you should see a directory structure and directories like the ones shown in the first image below.
Start the AVD.exe by double-clicking it.
You will see a window like the one in the image below
Take a close look and notice that this is running an ARM(armeabi-v71) image. When you download images you have to download ARM-based images. (no x86 images will work on VM).
Also, you cannot start these images from AVD that launches from Android Studio 2.x
Make sure you have an environment variable named ANDROID_SDK_HOME set to path which is similar to the one at the top of the AVD manager (in image).
Once you do all of this and start an ARM-based image on a VMWare VM it will warn you that it is faster with HAXM but at least the image will run.
Finally, you can see if you attempt to launch your Virtual Device from the AVD Manager in Android Studio then it will warn you that Hyper-V needs to be turned off. Of course you cannot turn Hyper-V off on a VM.
EDIT -- Running Android 7 ARM Image
#mcflysoft asked about running an android 7 ARM image. At first I didn't think it worked, but if you open up your SDK manager and install the exact ARM OS image shown in the following picture, it will run on a Windows VM:
ARM image Containing Google APIs
I tried installing the ARM image that contained the Google APIs and that one would not ever start. There were failures logged which I could see in c:\> adb shell logcat.
Beware : It Is Really Slow
However, running Android 7 seems extremely slow and I don't see a web browser.
Not sure how helpful it may be to you, but you can get it working.
Good luck.
The simplest solution I've found so far is to use a device farm, for example Samsung's device farm:
https://developer.samsung.com/remotetestlab/galaxy/rtlDeviceList.action#444
It's free to use and you can deploy your apps just like in an emulator (Right Click -> Test -> Remote Debug Bridge -> follow the instructions).
And since those are real devices, the speed might be even better than on an emulator on your personal PC.
I've had the same problem so I'll post an answer in the hope that someone might find this useful in the future. I can run Android Studio in my VM but when I try to start up an emulator, I can't download an image due to "Your CPU does not support required features (VT-x or SVM)"
Although I didn't get a virtual device up and running, I got round the problem by using BlueStacks. You install BlueStacks on the VM. BlueStacks (at the moment) runs Android 7.1.1, SDK 25. Inside BlueStacks, go to Settings/Preferences and Enable Android Debugger Bridge (adb) following this set of instructions. Then you should be able to run your app on BlueStacks from inside Android Studio. Logcat can see any log statements from BlueStacks.
The alternative (without enabling the debugger bridge) is to locate the .apk file for your app and then open that with BlueStacks APK installer. Logcat still sees the traces.
It's slow on a VM. You also have to set android:testOnly="false" in your XML file
Since I read the news about Xamarin now being "free", I immediately installed Visual Studio 2015 Update 2 and the Android tooling (NDKs, SDKs for 19-23, Visual Studio Emulator for Android dated January 2016) to start working on an Android application.
Excited I launched the emulator from Tools -> Visual Studio Emulator for Android and installed the profile that is the best match for my own phone. Since my phone is on Android 6, I decided to get a profile for API Level 23 / Android 6.
Since I had already enabled Hyper-V a few months ago, the installation for the profile only had to add me to the Administrators group and create 2 network adapters.
So far, so good.
Upon starting the emulator, it would stay at "OS is starting...". I figured I'd wait a while. I figured I'd wait a while longer too. After that, I gave up the possibility of it going to work and started investigating.
I also tried other profiles, a few others from API Level 23, one from 22 and one from 19. Only the ones from API Level 23 did not work.
The following steps are what I came up with so far by Googling etc. I tried them in all sorts of combinations:
Rebooting
Disabling / enabling Hyper-V
Removing vEthernet adapters (through the Hyper-V Manager).
Running XDECleanup
Allowing XDE through my Windows Firewall as application (incoming)
Restoring the emulator software in Programs and Features
Enabling / disabling "Processor Compatibility" in Hyper-V Manager.
This is the data I've gathered so far:
A screenshot of the error message that the emulator gives after waiting a long time (10 - 15 minutes, maybe a little longer)
A screenshot of the last part of the log when being connected to the Android 6 VM:
A screenshot of the last part of the log of a working VM (this one's from an Android 4.4 VM):
Responses I've got so far from Microsoft:
-Those errors are normal
-And the only step I've tryed which they told me to, and I don't see here, it's this one:
On Hyper-V Manager, check the option for compatibility under CPU section
Besides from this, just make sure that on Hyper-V you get only 2 switches, the one you use to connect to the internet and the one that the VS Emulator for Android creates, I haven't got any results, but if you try, maybe you will.
In my case, I was mucking around with the VS emulator's virtual switches and had the network adapters in the wrong order.
After I moved the Windows Phone Emulator Internal Switch (Created when first running the VS Emulator) to the first Network Adapter slot in my settings, the emulator started up just fine. Apparently, order matters.
Had the same problem but got mine to work after trying a lot of things from different threads.
In the end I think this did the trick for me:
I added "c:\Program Files (x86)\Microsoft XDE\10.0.10586.0\xde.exe" as an exception in the firewall.
(i also switched of the firewall, but was probably unnecessary)
Temporarly disabled the WiFi device
Uninstalled VirtualBox
Removed all Virtual Switches in Hyper-V
Executed XdeCleanup.exe
Started the emulator again and it started up successfully!
Swiched of the emulator and enabled Firewall, Wifi device.
The emulator still starts successfully every time!
Thanks to all for sharing!
If you're using Xamarin, it's recommended that you use Xamarin Player. It's not Xamarin exclusive, it's just a much faster Android emulator. I use Android Studio, and the Xamarin Player is still faster on boot and launch than the default. This is just my recommendation to you, I have no clue how to fix your Visual Studio emulator, sorry.
I've played a lot with this and realized that I have had manually configured paging file on Windows. After restoring it to default all worked perfectly without messing with the virtual switches or adapters.
Just make sure that you have all Windows memory etc. settings set to default.
Regards, Mladen
My problem was that the system image was missing for the emulator.
When I opened the android virtual device manager it had an exclamation mark next to actions(i had to download the system image via the download link).
I had the same error message. The solution for me was:
Uninstall all emulators in the Visual Studio Emulator for Android
Check in Hyper-V-Manager if there also no instances
Unistall Visual Studio Emulator for Android
Run xdecleanup.exe (C:\Program Files (x86)\Microsoft XDE)
Uninstall Hyper-V from Windows features
Removed virtual ethernet adapters through uninstalling in Device Manager
(be sure to display disabled devices too)
Install Hyper-V from Windows features
Install Visual Studo Emulator for Android again
Download and install your emulator/profile
Run the emulator and have fun :-)
It seems there was a problem with the virtual switches and Hyper-V. The correct settings for the adapter looks like these:
Hyper-V-Manager:
Device Manager:
Network adapter:
Ethernet:
vEthernet (Virtueller Switch: Intel(R) Ethernet Connection (2) I219-LM #2):
vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch):
Emulator network settings:
This is driving me absolutely crazy and I can't find any help. I'm fairly novice when it comes to emulators, and even more so when it comes to Android Studio. Here's my problem: I installed Android Studio. Downloaded the SDK updates, including the HAXM one, and set up my own AVD. Upon trying to start up my AVD, or even the starter AVD that was already there, I get an error stating that "emulator: ERROR: x86 emulation currently requires hardware acceleration!"
I've done some googling and tried to finish the install of HAXM using the install file in the Android/SDK folder. I was promptly told that the installation failed and that my CPU didn't allow for Intel Hardware Acceleration, or something like that. I read somewhere that the only way I can use Hardware Acceleration on AMD is if I were on Linux, with which I have no experience with. So I tried giving up. Now I can't figure out how to disable Hardware Acceleration entirely in Android Studio. I haven't even begun learning how to write in android because I can't get an AVD up and running.
Does anyone have any tips for a complete Android noob? I thought this would be something fun to try since I was at once point fairly good with C++ and I have always been a huge fan of android. However, I've avoided doing anything GUI related until now, and I'm not finding it very fun at the moment.
I'm running an AMD system with 8GB of ram. More specifically, I'm using an AMD FX-4130 Quad-Core Processor on a GIGABYTE GA-970A-DS3 Motherboard.
Unfortunately AMD's virtualization technology AMD-V is not compatible with Intel HAXM. Your only choices are to either get familiar with Linux or use a ARM-based AVD, which doesn't require virtualization.
You can find instructions for Linux on Android Developers' document on Using the Emulator.
You can use Genymotion instead of default one. Its faster than the default one. And this emulator is compatible with both Intel and AMD. Genymotion just uses Virtualbox to run Android in VM.
Here's a link to Genymotion .
Genymotion , Genymotion user guide
it may help you.
Take an android phone with its USB cord then follow these steps:
1. plug in phone to computer.
2. on the phone goto: settings>about device scroll to find build number
3. press build number 7x (this enables developer mode)
4. go back to settings press developers options select usb debugging, include bug reports, verify apps via usb, and GPU force rendering.
5. Check for device connection on the computer
6. add in build.gradle under "buildTypes{" write this
debug { debuggable true }
then when you run your project you should be able to see your phone in the avd selection then select it. Your phone will awaken automatically with your application running except it will be a little semi-efficient boot process.
Also do not forget to remove the debug code from your gradle file when you app is finished.
I'm trying to use the Intel HAX x86 emulator for Windows (8, if that matters). I installed everything and created an AVD for the android version, and everything appears correct, but when I run it, I get this output:
Starting emulator for AVD 'x86_QVGA_Level10'
emulator: device fd:1044
HAX is working and emulator runs in fast virt mode
emulator: Failed to sync vcpu reg
emulator: Failed to sync HAX vcpu context
and the emulator won't run. The significant part of this error (Failed to sync vcpu reg) is not mentioned ANYWHERE online, except in the source code for the HAX itself, but I can't figure out how to make any sense of this.
Can anyone advise about how to get past this error? I really need to get this working, because debugging on device and in the default emulators is painfully slow.
Make sure you don't have any virtual machines running. In my case, I had genymotion running which was causing this error.
I had virtualbox running. Killing the VM allowed allowed the emulator to run.
If you are running Docker you would have to take the virtual machine down
docker-machine stop default
This assumes your docker machine is called default. If you want to check the name use
docker-machine ls
A simpler solution; open virtuabox and stop the vm :-)
I had this problem. For me it was the HAXM version.
When you get a new version of HAMX through the SDK Manager, it tells you that it is installed. It is not. You must go to this folder:
<Android SDK>\extras\intel\Hardware_Accelerated_Execution_Manager\
and run intelhaxm-android.exe manually. In my case, I had 1.0.6 and upgraded to 1.1.
I think that what caused the error in the first place was that some other part of the SDK that I had updated needed 1.1.
As mentioned by other answers, make sure no VirtualBox and docker service is running with following command in mac. (systemctl in Linux)
$ launchctl list | grep 'VirtualBox\|docker'
- 0 com.docker.helper
640 0 com.docker.docker.2032
31736 0 org.virtualbox.app.VirtualBox.948
If so, kill the VBox and docker service.
launchctl stop org.virtualbox.app.VirtualBox.948
launchctl stop com.docker.docker.2032
Do you have HP SureClick running? I had the same problem on the HP laptop until I disabled it.
HP SureClick is a security protection program which runs "unsafe" programs in micro-VMs. It may also be called HP Wolf Security on your machine, which is the new name for it, although under the hood (e.g. folders, dialogs etc) it's still called SureClick. It may have some processes visible in Task Manager with a prefix of "Br", which stands for Bromium.
Similarly to other answers, it cannot be running at the same time as Android Emulator, as it is basically a virtual machine.
Here are some steps to disable it (not all may be required but this worked for me):
Right click on "HP SureClick" or "HP Wolf" in your system tray and select "Disable Threat Containment". It will pop up a dialog asking for the reason (optional), so just click OK
Right click on the icon again and select "Disable Malware Protection"
Click Start, type "services", open the Services window and set all "HP SureClick" services to disabled by right-clicking on each -> Properties -> change startup type to Disabled (for me there were 3 such services)
Restart the computer
After doing this, I was able to use Android Emulator again :)
Stop GENYMOTION (open VirtualBox instance if any instance is running, stop it).
Open AndroidStudio -> Run AVD Manager-> run AndroidStudio virtual device.
Latest Android Emulators are not able to run in parallel with GENYMOTION
"vcpu reg" are "Virtual CPU REGisters" that exist on many processors that have things like multiple cores, hyperthreading, or other features that enable higher layers to believe that there is more than one CPU present when there isn't -- such as today's x86s. No reason to go in to detail -- you can imagine that getting a coherent, single "virtual CPU context" is necessary for the kind of hardware virtualization that HAX offers.
Normally, it's not a problem to run multiple virtual machines of various sorts simultaneously. But if one of them crashes, or misbehaves, or just decides to be a hog, HAX might find that it just can't put together a coherent virtual machine, because it can't sync a virtual CPU context for itself. It'd be like trying to run a real machine with no CPU.
Bottom line is open task manager and kill things that you don't need and that look like they might be holding virtual machine resources. In the worst case, a reboot is almost certain to fix the problem.
Quick steps:
Stop all VirtualBox Virtual Machines (i.e. vagrant halt), quit VirtualBox.
All docker-machines should be stopped, too. Quit Docker.
This happened to me also when I was trying to run both VirtualBox and Android emulator in a MacOS machine. As others have mentioned above currently it is not possible to run both (i.e. VirtualBox and X86 -Intel based emulator) in MacOS and not sure about the other platforms.
If we need to run both we can choose ARM based emulator. (arm based emulators are normally slow)
I was getting the same error. I'm guessing there are various reasons for this error, but in my case it was because of a service named ".NCG". The service is Network Content Guard by Inka Entworks, and seems to be some type of DRM solution. Once uninstalled, the emulator worked fine using HAX.
In my case, it turned out this problem was caused by having a webcam selected as "Front Camera" in the settings for the AVD. Setting it to "Emulated" fixed this problem for me.
I faced this issue because I had my virtual box running with Ubuntu on it. When I shut down my virtual box I did not face this issue.
I got the same error on my windows 8 install.
Things you could try:
lower the amount of memory for the emulated device (and/or close other applications)
disable GPU emulation
remove the pass-through webcam
For me, the error occurs when I try to attach a physical webcam to the emulated android instance.
This kept failing until I changed it to [x] Use Host GPU as shown in pic.
I'm running boot2docker vm, just down it solved the issue.
boot2docker down
Make sure you don't have any virtual machines running. In my case, I had genymotion running which was causing this error. when i kill genymotion's Process and kill all Oracle VM VirtualBox related process then it work
by wangshiming
don't thankyou me
Ya, i had virtual box running and was getting this error, shutting it down fixed the error.
I was on a mac and had this problem. I did not think I was running a VM (I have vbox but it isn't running). I restarted my computer and before starting any other apps I tried the emulator and it works fine.
This is the VirtualBox ticket - https://www.virtualbox.org/ticket/14294
Fixed the problem by changing current version of Java within Windows from Java 8 x64 to Java 7 x86.
Yes, VirtualBox VMs have to be stopped. I also had to stop Docker for Mac. The error message only mentions VirtualBox, which confused me a little until I realized Docker for Mac is running xhyve.
If your CPU supports throttling (like Intel's SpeedStep) try to disable that feature in your BIOS. It's kind of a quickfix but at least it worked.
I think it must be a variety of reasons cause this failure. In my case, since I installed the Google input method software, "Failed to sync vcpu reg" appeared. This was the one and only change before normal working. So, after uninstall the Google Input software, it was recovered.just a little reference, although I can't believe this solution for long time either.
I had the Windows Virtual PC running (on Windows of course). Once I turned off, the emulator went fine.
Hope this helps.
I was trying to launch a Gingerbread 2.3.3 x86 emulator and it would not launch. Changing from x86 to arm made the problem go away.
For me, the only thing that worked using adv on MacOs Yosemite, is setting the processor to ARM (native CPU of the device - standard 4" Nexus).
If you are having any virtual machines running, suspend them and try again.
For me the answer was to set Enable keyboard input to true under the advanced settings of the virtual device.
This was the first option I changed on the device, so it is possible that the act of changed an option fixes the error as well based on the wide array of answers above.
Note: I've confirmed previously that no VM's are running.
Finally, I found the anwer for this question.
I had exactly the same problem and it was completely solved.
Virtual device or webcam is rarely the cause of your problem.
Just install mainboard chipset driver.
I recommend you to use 3DP chipset autoinstaller.
Good luck!