Android emulator and virtualbox cannot run at same time
Whenever I have Virtualbox running, I cannot start an Android emulator image (and vice versa). The error message in the AVD manager is
ioctl(KVM_CREATE_VM) failed: Device or resource busy
ko:failed to initialize KVM
How can I make both run at the same time?
That is a Ubuntu 64 bit, all involved software is of the latest released version.
Removing the kvm kernel modules (using 'sudo rmmod kvm_intel kvm') makes it possible to run the Virtualbox and the Android emulator at the same time but the performance of the Android emulator in such a setup is extremely bad. If possible it is better to shutdown the Virtualbox emulator and unload its driver (vboxdrv) by running 'sudo /etc/init.d/vboxdrv stop'. Google suggests this "solution" on its Android Emulator page in the section about Linux.
I got the same VirtualBox conflict. Solved it by using ABI different from "x86" (armeabi-v7a in my case)
I stopped the virtual machines I had running with VirtualBox. This made the error disappear.
I had the same problem on Ubuntu 13.10. Try to remove kvm and kvm_intel kernel modules.
To do this:
- Stop all emulators.
- Run command: 'sudo rmmod kvm_intel kvm'
Without these kernel modules Virtualbox and Android emulators can work at the same time.
BTW, I do not know why the modules are loaded.
There is finally a fix for this.
Follow these steps for macOS:
-
In Android Studio Go to Tools -> Android -> SDK Manager
-
Confirm you have the latest version of Intel Emulator Accelerator HAXM installed (v6.1.1) .
-
Go to the
extras
directory of the Android SDK location displayed in the preferences. On MacOS you can do this:open ~/Library/Android/sdk/extras
-
Install the HAXM packing by opening IntelHAXM_6.1.1.dmg, then opening IntelHAXM_6.1.1.mpkg in the mounted folder, and following the installer instructions.
Follow these steps for Windows:
-
In Android Studio Go to Tools -> Android -> SDK Manager
-
Confirm you have the latest version of Intel Emulator Accelerator HAXM installed (v6.1.1) .
-
Go to the
extras
directory of the Android SDK location displayed in the preferences. Something like:C:\Users\<username>\AppData\Local\Android\sdk\extras
-
In that directory is some kind of file like
intelhaxm-android.exe
. Run it.