Running Android apps for development purposes

The next major version of ProjExec is going to support mobile devices, and in particular Android. This means that the developer needs a way to test the application while developing, and the sales guys need a demo environment.
As probably everyone, we started with the emulator bundled with the Android SDK. It has several advantages:

  1. It comes out of the box with the Android SDK, for free
  2. It is heavily configurable, so you can choose from a list of existing devices to emulate, or create a custom one
  3. It can emulate several hardware architectures, including ARM and x86
  4. It behaves like a real device, including the side buttons

If this emulator is technically working, it is actually barely usable in the best case. Most of the time, it is slow as hell... The recent Intel HMAX, now bundled with the SDK, makes it faster because it natively runs x86 code. But still, if it makes the experience better, it executes slowly.

Fine. To get a better experience, I bought a real device. A 10" quad core cheap tablet from Amazon. I got a very good deal for it and, at that time, Android 4.2 was perfectly fine for development purposes. I've been pretty happy with it, once I passed the configuration steps. Forgot to say, you need to install a USB driver on your development PC to communicate with the tablet. And none is offered by Matricom, or other cheap manufacturer. I finally found a generic one that barely works: it does not see the tablet as a USB disk, but the Android Debug Bridge (adb) sees it properly. Good for dev purposes.

Now came Android 4.4, aka KitKat. I wouldn't normally look to upgrade, but this time is different. Its browser component is now based on Chrome. This is a game changer for developers because this component can  be remote debugged from another machine, directly from Chrome. See: Remote debugging on Android with Chrome. Wahoo, this works very well for hybrid apps using Apache Cordova. That's make a KitKat based device really indispensable! But wait, my cheap tablet runs 4.2, with no update in the pipe. It suddenly became obsolete. I haven't opened it for 2 months now. If one knows how to upgrade it with a generic version of KitKat, please let me know. Else, it will finish in the cemetery of obsolete devices, or in the hands of a kid in the neighborhood. By the way, I *hate* the way android devices get OS upgrades. Google should learn from Microsoft, as I don't need to change my PC when I want to update Windows. But this is another debate.

Alright. Before I spend more bucks buying a recent KitKat based device, I investigated alternate solutions.

One of them is provided by a French company called Geny Motion. It is another emulator, based on Oracle's VirtualBox. It is much faster than the emulator from the SDK, with a lot of devices being emulated. Plus, it emulates many sensors. But it has a cost that can be seen as prohibitive (>$400 per developer, per year). Hum, I might buy a few licenses over time. But this can be complex if you hire free lancers. Not sure how the licensing model would work. Google should acquire them and get their emulator integrated into the SDK, similarly to what they did with Instanciations' WindowBuilder. That would really help the Android community.

A recent announcement also caught my attention: the port of Android 4.4 to x86 is now officially available. In short, you can run Android as your main desktop PC OS. This is fun, but I don't see why I would do that on my machines. Except if it can run on a PC, then it can be also installed in a virtual environment Couldn't wait to try it on VMWare. I found many blog posts or videos telling the steps. It took me less than 30 mins to get it downloaded, installed, configured and running. It can be even faster if you run VirtualBox and download the preconfigured image (eeepc). And it is blazing fast. It feels faster than any real tablet I tried so far, even the latest 12.2" from Samsung. This is just brillant! There are still missing bits, like the availability of VMWare tools for Android, but this is sugar. Someone will certainly find out how the FreeBSD ones can be installed.

Back to my development use case. Once the VM is running, you can configure the developer options the same way you would do it on a regular device. And the you can remote access it by simply running one adb command. This is well explained here.

It does not fully replace the SDK emulator, or GenyMotion, as it doesn't provide a phone like experience, but it is great for core development and demo.

Let me know if you have the same experience, or have any trick to share. I can start with a few:
- If it goes to sleep, press the 'esc' key for more than a second to awake it (see: wake up). But better to configure the display to never go to sleep, in the Android Settings.
- The 'Power Off' button can be displayed by dragging the top right bar down (where the time is).
- Changing permanently the default resolution is done with a few edits, detailed here (easy!)
- Configure a fixed ip for you device, that makes adb easier to use

Enjoy Android development!


Comments