7

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.

  • So "another VM" is not running Android (e.g. the Android-x86 project which one normaly runs with VirtualBox), but it's just "some other VM" (e.g. running Linux or Windows), like in the linked question – so it's basically the very same issue? – Izzy Feb 17 '16 at 9:29
  • 1
    It IS the same issue, except, that there they wanted to be able to run the android emulator, and closing other VM-s were a sufficient solution, and in my case I explicitly stated that I need both VM-s running side by side. – Gavriel Feb 17 '16 at 9:31
  • This isn't about development specifically so Stack Overflow would not be a good fit. Super User would probably be but, since we do support emulator use here, I think it's fine to stay. I've incorporated some info into the question and cleaned up some comments. – Matthew Read Feb 17 '16 at 22:02
  • If you don't need to run your app specifically in the emulator, you could run it in an android-x86 VM using VirtualBox or a Genymotion VM (which is a wrapper of VirtualBox) alongside your Linux guest. – Paul Ratazzi Feb 18 '16 at 1:39
  • Unfortunately I can't use Genymotion, it's failing. Maybe I'll open another question about that. – Gavriel Feb 18 '16 at 7:01
1

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.

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.

  • What is "emulation stack"? I am able to run multiple andorid emulators, and I am also able to run multiple VM-s in Virtualbox. You're saying there's no chance I will be able to run one VM in VirtualBox and one android emulator from Android Studio? – Gavriel Feb 17 '16 at 9:32
  • 3
    Though that's possibly true, mind to give reasons? Any backing for your claim (with some background) would be nice. – Izzy Feb 17 '16 at 9:32
  • 2
    @Gavriel what Aeyoun most likely means is while you can run multiple VirtualBox VMs in parallel, it's the same "Stack" they run on (VirtualBox, which manages them). But you cannot start a different "stack" (say, VMWare or Android Emulator) while there is already one running, as there's probably some resource locking in place. That's just the idea I get, I've got no proof for this – which is why I asked Aeyoun to provide some background ;) – Izzy Feb 17 '16 at 9:35
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.

-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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.