Skip to content

Setting up Travis CI

Roger Hu edited this page Oct 15, 2015 · 31 revisions

Overview

Travis is a continuous integration service that enables you to run tests against your latest Android builds. You can setup your projects to run both unit and integration tests, which can also include launching an emulator.

Signing Up

Login to Travis CI and sign-in with your GitHub credentials. You will need to grant access to any repositories that will be used. If you are using a private repository and don't intend for the source code to be shared, you will need to signup for a paid subscription plan.

Setup

You simply need to create a .travis.yml file in the root directory. The simplest configuration to install the Build Tools and Android SDK 21. You can launch the Gradle wrapper to build and run emulator tests.

language: android
android:
  components:
    - build-tools-22.0.1
    - android-21

script:
   - ./gradlew build connectedCheck

See the docs here for more information. By default, all SDK license agreements are accepted but you can also dictate which ones to accept.

Design Support Library

If you are intending to use the new Design Support Library, you will need to make sure to include the extra-android-m2repository component in travis.yml:

language: android
android:
  components:

     - extra-android-m2repository

Otherwise, you are likely to see the following error message:

Searched in the following locations:
  file:/usr/local/android-sdk/extras/google/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.pom 
  file:/usr/local/android-sdk/extras/google/m2repository/com/android/support/support-v4/22.2.0/support-v4-22.2.0.jar

The reason is that the Design Support Library must be downloaded from the SDK Manager, which looks in the repository manifest for the Local Maven repository for Support Libraries package. The support library is currently not yet available on a public Maven repository.

Google Play Services

If you intend to use Google Play Services with Travis, you will also want to add the extra-google-m2repository too:

language: android
android:
  components:
     - extra-google-m2repository

Finding these guides helpful?

We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.

Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.

Clone this wiki locally