Setting up Travis CI on an Android Gradle project!

Brian Chew
May 17 · 3 min read

Hello everyone, I’m super excited to help you out with installing Travis-CI. You might have some questions before we start!

What in the World is Travis-CI?
Don’t worry! Travis-CI is simply a CI (continuous integration) service to help you build/compile and test your projects. (mainly on github).

Is it hard to set up?
Absolutely not. It’s just a single yml (a data serialization language for configurations) file and some clicking here and there. You only need to set up .travis.yml so travis-ci knows how exactly to test your code, and in what conditions! Although it took me several tries to get my .travis.yml working.. here are some things to note!

Things to take note:
Travis may not work on every sort of android project (you really have to customize the configuration file accordingly… it might take you several tries to set it up as well. The simpliest thing like an image with a different signature type might totally just fail the test.

The travis.yml file that is at the end of this blog post may not be the same as your final intented one, so do make sure to make the appropriate changes to yours!

Let’s get started!
To get started, you’ll need a Travis-CI account, or you can log in via Github. I’ll skip this section and move on to the more important ones!

Next up, make sure you select the repository you want to put this on. I believe it has to be public, but i’m sure you can set it up for members within github organisations only.

Placing your (.travis.yml) file into your root directory of your project (in this case if it’s an android project –> where your build.gradle is (here is a picture of where mine is..)

Now, all you need to do is add a travis.yml file to trigger an inital build and see if it passes, if it doesn’t just check the logs.. It looks like this at the end, (PS, if you can’t trigger the build make sure you enable auto-build for push in your travis-ci project settings!)
When your travis-ci build passes!
Or not!

Although, you can see that Travis tells you the error and you can fix it. If you are working in a team, it helps to be able to self-test every last bit of code in a different environment so that you know your teammate will be getting a working copy, or not… Don’t worry if you get this problem though… just look up and see what’s going on!

Once you’re done, whenever a teammate commits and pushes the code… travis automatically picks up your latest repository version and tests (by reading how from your .travis.yml file!).. and you can see if it succeds or not! (PS: Travis also knows to cancel your tests whenever you update a file!)

You’re done! Congratulations on setting up your travis-ci project! If you require any help at all please feel free to email me @ brian(at)

My .travis.yml file! :

Useful documentation to customize your .travis.yml file :

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade