This document explains how to use Genymotion on a Jenkins continuous integration server, in order to run the instrumented tests of your Android application.

Using the Gradle plugin for Genymotion in an Android project

To use Genymotion on a continuous integration server, you must automate the launch via the Gradle plugin. This tool will create, confgure and launch automatically devices, just before your tests task. You can refer to the documentation of the Gradle plugin for Genymotion.

Once the Android project is ready, you must configure the server so that it can receive this kind of task.

Prerequisites of the server hosting tests

Running Genymotion

To run Genymotion instances, your machine must observe the following prerequisites:

  • The minimum hardware configuration:
    – VT-X or AMD-V capable CPU (not a VM, but bare metal)
    – 10 Go disk space
    – OpenGL 2.0
    – 4GB RAM
  • The server must have a running and functional X server. You cannot use a command line only OS.

Your integration server (hosting Jenkins) does not need to run Genymotion itself, but you must have a computer accessible on the network, able to run Genymotion instances. To do so, you must use the method of nodes, detailed below.

Installing Genymotion with gmtool
In this context, the use of Genymotion is automated, you must therefore use gmtool binary. Once the installation is performed, check that instances are launched directly on the destination machine to grasp the possible dependencies to be installed. Also, if an error related to incompatible Qt libs arises, follow the procedure given in the FAQ.

Installing the Android SDK
To run a build of an Android project, the host computer must have the Android SDK installed. It is available here. The installation must be performed on the computer on which instrumented tests will be run. Once the Android SDK is downloaded and extracted, you must install the required additional libraries, according to your Android project.

This can be done in command line via the binary


as briefly explained here.


Note: It is possible to automate the acceptance of the license during a lib installation by injecting “yes” into the command like this:

(while true; do sleep 1; echo yes; done) | android update sdk ...


Caution: Command

android sdk update -t 1,4,...

causes problems if we use indices presented in

android list sdk.

Instead, use identifiers given in command

android list sdk --extended.


Adding the Android project to the Jenkins server

You can now add your project to the Jenkins server as you would usually do.

If your server is able to run Genymotion, you only need to run the dedicated Gradle task (“connectedAndroidTest” or other) and everything should run seamlessly.

If the machine hosting Jenkins is not able to run Genymotion, you must delegate the task to a node on your network.

Adding and configuring a node

A Jenkins node allows to move the processing of a Jenkins build to another PC than the one hosting the CI server. Here, we’ll be using a node to run a build and then run the instrumented tests of an Android application.

To add a node to the server, please follow the official documentation.

Once this is done, you must add the following environment variables:

  • ANDROID_HOME, containing the path to the Android SDK.
  • DISPLAY (required only on  Linux), containing the display identifier in charge of the Genymotion interface.

Note: In many cases, the variable will contain :0. It designates the first X client launched during startx. To know the variable to use, open a command prompt and run the command


It will return the field content.

Finally, in the configuration of the Android project to build, you must indicate the slave on which you want to run builds.

To do so, you only need to check Restrict where this project can be run and indicate the node(s) on which you want it to be run, as shown below:

Capture du 2015-03-03 16:35:21

Congratulations! You now have an integration server able to run your instrumented tests on Genymotion.