Posts

Showing posts from May, 2013

Android Testing in Headless Emulator

When testing Android applications you have to rely on running the tests in the emulator or a device attached to your computer. However, if you want to follow a continuous integration workflow for Android development, you might need a headless emulator that runs in a non-graphical environment. For instance, I have been using Travis CI and Gradle for automating Android builds.
To completely avoid showing the emulator interface (headless emulator) you need to start the emulator with some options in your terminal.

First, you can create an specific Android AVD as follows:
1androidcreateavd--force-ntest-tandroid-17--abiarmeabi-v7a
Then, to run the headless emulator:

1emulator-avdtest-no-skin-no-audio-no-window
The '-no-skin' option removes the emulator buttons such as the home and other hardware keyboard buttons.

The '-no-audio' option disables the audio support.

Finally, the '-no-window' option disables the emulator's graphical window display.

Now yo can use this…