In a previous post I talked about using the Android-x86 Android Virtual Device. Here I give a step-by-step account of how to configure it. For completeness, I’ll describe how I got it working in SkyTap.
My starting point assumes that you have a development machine deployed with your cloud provider and that you have the Android development tools already installed. My examples and screen shots are from an Ubuntu machine but it works just as well with Windows. Before you go any further, you must verify that your provider supports nested virtualization. If not then you can easily adapt these steps to work on your local machine but the Android X-86 image will not work nested on your cloud based machine.
Go to the settings for your virtual machine and under Hardware, check the Enable nested virtualization box.
I’m not going to tell you how to do this but you can download the image from https://www.virtualbox.org/wiki/Downloads
From the VirtualBox menu select New and run through the wizard. The critical bits are that you specify that the virtual machine is Linux and the version is Linux 2.6/3.x(32 bit). I allocated 2Gb of RAM and took the defaults for the allocated disk space.
I used the 4.4-r1.iso download from http://www.android-x86.org/download
I tried several times to actually install from the image, each time I did so, the load eventually froze on me. I eventually settled on the following strategy:
Start the machine as a Live CD, this forces you to run through the set-up wizard so you do not want to do it each time. When you are finished just suspend the Android-X86 image fhrough the the VirtualBox menu.
It is really important that you disable mouse-integration (from the Virtual-Box Machine menu) otherwise, your mouse clicks just get lost.
It’s really important that when you shut-down the virtual machine you don’t! If you do perform a full shout-down then you will have to go through all the start-up configuration all over again. When prompted to close the virtual machine make sure you select Save the machine state. That way, the start up will be pretty much painless.
Before you can debug you need to connect the debug bridge (ADB) to the device running in Virtual Box. To do this, you need to make sure that Virtual Box is configured to used Bridged networking. Then on the Android device, go to Settings | About | Status. You should then find the IP Address of the emulator. Now, start a terminal / command prompt on your host machine and type adb connect X.X.X.X:5555
Once ADB is connected, you should be able to debug in exactly the same way as you would normally (provided you are using Eclipse ADT). If you are prompted to choose a device then the Android X-86 device should be there in the list. Unfortunately, I can not see a way of making this work with Android Studio due to the mechanism used on AS to integrate with ADB. The problem appears to be that AS restarts ADB each time you select Run or Debug, loosing the connection to the Android VM you have just established. Maybe some IntelliJ expert can shed some light on this?
If the Android-x86 machine goes into a power-down state I’ve only found one way to wake it which is to send the ACPI Shutdown event either from the VirtualBox Machine menu or using Host + H (Host is normally the right CTRL key). Strangely, this does not seem to be documented on the Android-X86 site.
If you go down this root, you can indeed run and debug Android application in the cloud. I am however, not convinced that the technology is mature enough at the moment. You may find that irritations such as poor mouse behaviour will drive you to distraction. For me, the inability to make it work with Android Studio is currently a show-stopper.
To learn more, have a look at Learning Tree’s entire curriculum of Mobile App Development courses.