8

Whenever I open an Android emulator when a different kind of VM is already running, I get the "usual" error messages:

emulator: Failed to sync vcpu reg
emulator: Failed to sync HAX vcpu context

Here it is recommended not to run another VM, but what if I need the another VM for development, or to run the server for my Android app on it? Is there a way to run a VirtualBox Linux guest VM and the Android emulator at the same time? My host OS is OSX if that matters.

Gavriel
  • 200
  • 1
  • 1
  • 8

4 Answers4

2

You can’t run two different emulation stacks on your processor at the same time. Sorry, it wouldn’t happen.

Update: Your processor can only run one emulation system at the time. Kernel modules will “reserve” the right to use the processor’s emulation capabilities at the exclusion of any other emulator that want to use it. So you can only use VMware, VirtualBox, HyperV, etc. separately.

Daniel
  • 472
  • 1
  • 5
  • 20
2

Yes, there is a way to run a VirtualBox Linux guest VM and the Android emulator at the same time.

I have a working setup doing exactly this now, and its reasonably simple. To solve the problem above, you can run Genymotion as your Android emulator, and Virtualbox for your Linux guest VM virtual machine.

This counteracts the problem described in the answers above as Genymotion uses Virtualbox "underneath" as a hypervisor, meaning both of your Virtual Machines (The Linux Guest and the Android emulator) are running in the same hypervisor. This is exactly what hypervisors are meant for.

Also, to clarify the meaning of the poster in the link you gave, who states "it is recommended not to run another VM", I think what he means is that you can't also run other hypervisors (Docker and Virtualbox are described there) in parallel with Android Emulator, for the reasons described by other answers here.

0

emulator: Failed to sync HAX vcpu context

HAX stands for Hardware Accelerated eXecution. It is not really possible to run 2 different hypervisors correctly using hardware acceleration — they don't know what the other is doing and both would try to use the hardware for their own purposes. Trying to do so is more or less the same as trying to run two non-virtualized OSes at the same time, which clearly can't work.

Now, you might be able to run a purely software-based virtual machine at the same time as an Android emulator — but its performance will suffer greatly (depending on what you're using it for). I've found that the Android emulator is so slow as to be worthless without hardware acceleration, so you definitely don't want to disable it.

However, Memu seems pretty performant and plays nicely with VMware on my machine, so that might be an option for you. I have not tried any development with Memu, however; I couldn't get ADB to work.

Matthew Read
  • 50,777
  • 30
  • 148
  • 275
-1

It is indeed possible. You need to run HAXM version 6.1.1 at least.

If you upgrade to this version, it will work.

After upgrade, DO make sure the correct version is running by running:

$ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh -v

If it reports an older version, you might have to run the installer manually by running:

sudo $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
xavier_fakerat
  • 10,325
  • 6
  • 43
  • 103
grandnasty
  • 99
  • 1