Set Up Jenkins For Android : Continuous Integration

In this article, I will document how to achieve a fully working continuous integration system for android application using Jenkins.

We at NonStopIO Technologies, wanted to automated unit testing, and creating the builds. After the initial round of discussion with Saurabh Gawande and Sumit M we picked up Jenkins as our continuous integration tool and following is our learning from it.
Firstly, I downloaded Jenkins from the official website.

One can specifies a different port than the usual 8080 to make it unique and avoid any errors, in case another service is using Jenkins

java -jar jenkins.war --httpPort=9091

Next Step: Configure Jenkins

  1. Manage Jenkins > Configure System

Mentioned the ANDROID_HOME as my Android SDK path variable in Global properties.

2. Manage Jenkins > Global Tool Configuration

Here I told Jenkins where it can find GIT.

Next Step : Add New Item

Adding New Item is the easy part .Enter Item Name [ Android Application/Project Name ] and Select Freestyle project .

Click OK.

Next Step : Configure New Item

Next, go to Source Code Management. Configure you repository with Jenkins like below .

Also we need to git Credentials .So click on Add and your Credentials.

Select the newly added Credentials .

In Build Triggers, select Poll SCM
and add Schedule :

* * * * * 
Five time “*” with space .Which mean Jenkins will check after every minute if there are any changes in the git repository it will run the build.

In Build , Add build step > Invoke Gradle script

Select Use Gradle Wrapper and add the following tasks


Lets add some Post-build Actions .

  1. Publish JUnit test result report

2. Archive the artifacts

3. Editable Email Notification

In Project Recipient List add emails to which you would like to send email after each build . In above configuration I have attached the APK and the Build Log file .

All done .Click Apply and Save.

The Result .

Hope It Helps :)