Developing inside the matrix

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.

Error message regarding VirtualBox

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.

Trying to run BlueStacks

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

The Terminal Emulator app

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.

Executing adb commands

That is it.

Debugging an Android app inside VirtualBox from within VirtualBox on a Mac

Welcome inside the matrix.

1 comment:

  1. Here is a little more info on remote debugging.