Hooking Up Travis CI to GitHub
To hook up Travis CI with Github, simply sign in using your GitHub account. Next, select which repos you want to hook up:
Finally, add a .travis.yml file, such as the sample provided below, then push to kick off a build:
android: components: # Uncomment the lines below if you want to # use the latest revision of Android SDK Tools # - platform-tools # - tools # The BuildTools version used by your project - build-tools-19.1.0 # The SDK version used to compile your project - android-19 # Additional components - extra-google-google_play_services - extra-google-m2repository - extra-android-m2repository - addon-google_apis-google-19 # Specify at least one system image, # if you need to run emulator(s) during your tests - sys-img-armeabi-v7a-android-19 - sys-img-x86-android-17
Depending on the load, Travis CI will then kick off a build and email you the results.
Hooking Up Android Gradle to Travis CI
I found Travis CI to be difficult to integrate with Android Gradle from scratch, as the support is still in beta and there is a lack of documentation:
For example, I ran into the following cryptic issue:
Which I fixed by adding the following to my .travis.yml:
chmod +x grailsw
Ultimately, a blank slate configuration of Android Gradle with Travis CI (in its current beta Android integration) proved to be quite a difficult task. I decided to take a step back and evaluate other options.
android-tdd-playground is a good starting point to enable your projects to use Gradle, Travis CI, and even the Android Testing Framework. I simply forked the project and started moving over components from my Flickr Android app to the "playground" and customized as needed.
I recommend taking this approach when first starting with Travis CI, as it streamlines the integration and allows you to focus on your app.
Travis CI Badge:
The Travis CI badge gives visual feedback of the state of the last build. Adding the Travis CI build results is just one line of code to your README markdown: