The Mac is still a lovely machine for developers. I enjoy the beauty of macOS, its slick ui and versatile commandline interface alike. Don’t get me wrong. I love Windows, too. That is why I have a Windows 10 running inside VirtualBox. This allows me to work with Visual Studio, for example in order to write Xamarin-Android-Apps. There is one issue, though. The current version of VirtualBox does not allow me to run Hyper-V, the Android Emulator utilizing HAXM, or any other virtualization technology. Para-virtualization is not easy to implement, I am sure. Other products appear to offer this feature, but one of the beauties of VirtualBox lies in being free.
So, what can we do about this?
As a VirtualBox client shares the network with its host, I asked myself why the Android Debug Bridge should not be able to find an emulator running on… the host.
So, I fired up Android Studio and Android Emulator on the Mac. Here is what I got.
So while we may see a resolution in the future this does not help us now.
Other Android emulators appear to face the same fate.
So, are we left without options? Far from it… If VirtualBox is the only virtualizer that may run at a time, why not run Android inside VirtualBox? Just get an Android x86 image from the Android x86 project homepage, configure a client and install Android from the iso image. Make sure to configure a bridged network.
Once you have finished setup, you will be able to debug Android apps running inside VirtualBox from within another VirtualBox client.
Almost. A few steps remain to be taken.
First, get the ip adress of the emulated Android device. Open system settings, navigate to About Phone/Tablet and click on Status.
Second, open up the Terminal Eumlator app and enter the following command: adb tcpip 5555
Third: On the virtualized Windows client, issue the following command: adb connect <device-ip-address>
Finally, use adb devices to verify that the connection has been established.
That is it.
Welcome inside the matrix.