At Ravello Systems, our mission is to make the cloud look more like the datacenter. I have written about this many times, including on our advanced technology that makes this possible. In this blog, however, I will talk about something completely different: running the Android operating system in the cloud.
Android of course is Google’s smartphone operating system with a 79% market share. Together with Apple’s iOS, it forms the basis for a multi-billion dollar app economy.
The vast majority of Android devices today run on the ARM processor. When developing applications, developers can test their software by running it on an ARM emulator provided by Google as part of the Android SDK. The emulator is a full system emulator and is based on the QEmu open source project. It emulates an entire ARM-based handset and runs the Android operating system as a virtual machine inside it.
One solution that a lot of development shops and indies have adopted is to develop not on ARM but on an x86 version of Android. In theory, if your computer has the Intel or AMD hardware virtualization features, it is possible to run an Intel version of Android as a virtual machine at near native speed. The idea is that most of development and testing can be done on x86, and only the late stages of QA and acceptance would be done on ARM.
Multiple solutions exist for running Android on x86. A few common ones are:
>>> The Android SDK contains a system image for the Intel Atom processor. The emulator that’s included in the SDK can run the image at near native speed if hardware virtualization features are available. To access the virtualization extensions, the emulator uses KVM on Linux and Intel’s HAXM on Windows and Mac.
>>> The Android-x86 project provides system images recompiled from the Android Open Source release that can be run on VMware, VirtualBox and QEmu/KVM.
These solutions are mostly desktop solutions, and none of these solutions allow you to run Android in the cloud. Running Android in the cloud opens up very interesting use cases especially related to Continuous Integration. Imagine having a test suite that covers a large part of your code base and that can give you results within minutes of a commit. Extremely fast turnarounds like these can be achieved by running your tests on many parallel instances in the cloud – with no up-front costs, you pay only for what you use.
In the rest of this blog I will show you how to run the KitKat version provided by the Android-x86 project on Ravello.
The first thing to do is to download the .ISO file for the KitKat release candidate here. This ISO needs to be uploaded into the Ravello system using our CLI uploader tool:
$ ravello import-disk -u firstname.lastname@example.org android-x86-4.4-RC1.iso
The next step is to create a new application in the Ravello web UI, and then drag the “Empty” VM to the canvas. Configure the VM to boot from the ISO you uploaded, as shown in the screenshot below.
You should also add a supplied service called “adb” on port 5555, and make it external. We will use that below to connect to the image with the Android debugger. The result should look like this.
You may now publish the application by clicking the Publish button. It takes a few minutes to allocate the cloud resources, and then you should see the following boot screen.
Make sure to select the VESA mode option. Android will boot, and you will go through an initial configuration wizard. After a few menus, you will be presented with a familiar screen!
Due to the latency of the Internet connection, the graphical console experience is not as good as on your developer workstation. But for use cases like CI, that doesn’t really matter. To run commands remotely on this system we can use the Android Debugger (adb), which is part of the Android SDK. To connect to the Android VM, use:
$ adb kill-server
$ adb connect <publicip>:5555
$ adb shell
Below is an example of an “adb shell” window that is connecting from my local workstation to the Android VM in the Cloud:
You can also execute any of the other adb commands, such as “adb install” to deploy an APK.
That’s it. Hopefully this blog post was interesting to you. Feel free to leave feedback below.
To try it out yourself, you can sign up for a free 2-week evaluation period.
About Ravello Systems
Ravello is the industry’s leading nested virtualization and software-defined networking SaaS. It enables enterprises to create cloud-based development, test, UAT, integration and staging environments by automatically cloning their VMware-based applications in AWS. Ravello is built by the same team that developed the KVM hypervisor in Linux.