Android unit tests with Jenkins on a headless machine-ThrowExceptions

Exception or error:

I’m gathering information to set up a Jenkins CI server on a headless machine for Android unit testing.
But as Android unit tests require an emulator to run, a graphical environment seems required, or is it possible to run an emulator in non-graphical mode?
The wiki entry on the Jenkins Android Emulator plugin is also not very enlightening on this matter, it states:

If you have build slaves running headless (e.g. Linux servers that don’t run an X server), it is recommended to take advantage of Jenkins’ Xvnc Plugin.
With this plugin enabled, you can run multiple Android emulators in parallel on a headless slave, while keeping the “Show emulator window” option enabled.

Does this imply that emulators can be run on a headless machine with the “Show emulator window” option disabled??

If a graphical environment is required the easiest solution most sources speak of is by using the Xvnc plugin which uses an Xvnc server to provide an X instance.
But if I understand correctly this Xvnc server must run on another machine with X available, or does it run on the headless machine providing an X instance from there?

How to solve:

As the author of that plugin, I can tell you yes: you can run emulators on a headless machine, without a graphical environment — just uncheck the “Show emulator window” option.

This is the equivalent of running the Android emulator with the “-no-window” option on the command line.

I will update the wiki to make this clearer; thanks for bringing it up.


I have a similar setup in my project. But I chose Robolectric for my unit tests.

It is quite easy to run the Robolectric tests on Jenkins.

You may have to go for emulator for your system tests on a headless Jenkins server.

I still do not have a solution to run the system tests on a headless server.

Leave a Reply

Your email address will not be published. Required fields are marked *