Android App: Using Travis with Parse Server



Travis CI is a hosted, distributed continuous integration service used to build and test software projects hosted on Github. Travis can be used to automate all sorts of tasks such as building, testing, and deploying software, with continuous integration and facilitation of technical aspects of continuous delivery.

In this tutorial, we will explain how to build your own Back4App professional app aided by the Travis CI software. We will create a sample Android app using GitHub as the Git repository to test the continuous build feature of Travis. Even though we will focus on an Android app, you will be aided whenever there is a specific step just for Android, in a way that this tutorial will make possible to use Travis for other platforms.


Before beginning this tutorial, you will need to have Android Studio installed, preferably at the newer version, some familiarity with Cloud Code development and with Git version control system. Travis works only with GitHub repositories so you will need to create a new GitHub account if you don’t have already.

You can find tutorials for downloading and setting up your Cloud Code and a remote project for Git in GitHub in the links below:

Android Studio Official Website

Android Guide With Parse Server

GitHub New Project Tutorial

Cloud Code with Back4App

Step 1 — Create and set up your Travis account

Go to the Travis official website and Sign Up for a new account. It is recommended to use the option Sign in with Github, as it will be necessary to connect to GitHub in the process. Proceed to fill the information as needed. You should end on the following page if all went well.Account creation successful page

You need to wait a few minutes for the Travis server to synchronized information from your GitHub account. After that time, you will go to the next page, where you need to click the profile button to choose which of your projects you will use together with Travis.

Travis Get Started guide page

In the profile page, you need to select the project you want to use with Travis. You can click the gear button on the left side of your repository name to change more advanced configurations about how the continuous integration will work with your app. It is recommended for you to turn on the option Build only if .travis.yml is present for more safety in the continuous build process, as it will throw an error if your repository doesn’t have one.

Profile page to choose your project

After that, click on the Sync account button and go back to the Travis official website to continue the tutorial.

Step 2 — Create your configuration file

It is needed to add the configuration file .travis.yml to your project to specify how Travis should build your project. To do that in the Android Studio environment, just continue to follow the tutorial below. For other languages, you can check more information in the Travis Language Specific Tutorial on how to create that file.

The first step is to create a .travis.yml file in the root of your project source. After that, open it and write the following code to it.

language: android
jdk: oraclejdk8
# Turn off caching to avoid any caching problems
cache: false
sudo: true
    - ADB_INSTALL_TIMEOUT=2 # minutes (If ABD instalation pass this time, the build will throw an error)

    - platform-tools
    - tools
    - android-$ANDROID_API_LEVEL
    # Google Play Services
    - extra-google-google_play_services
    # Support library
    - extra-android-support
    # Latest artifacts in local repository
    - extra-google-m2repository
    - extra-android-m2repository

   - android-sdk-preview-license-.+
   - android-sdk-license-.+
   - google-gdk-license-.+
   - android-sdk-license-5be876d5

# This step is made for automatic acception of licenses whenever Travis builds the code.
  - mkdir "$ANDROID_HOME/licenses" || true
  - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
  - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
  - chmod +x gradlew
  - ./gradlew dependencies || true

# Run your main script
  - ./gradlew -PdisablePreDex

Verify that the versions of your Android API, Android Build Tools, and your JDK are at their correct versions compatible with your build.gradle. An example of build.gradle file can be found below:

apply plugin: ''

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.root.travis"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner ""
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('', {
        exclude group: '', module: 'support-annotations'
    compile ''
    compile ''
    compile 'com.parse:parse-android:1.15.7'
    testCompile 'junit:junit:4.12'

After that, you need to push this file to your remote repository. Now your project should be building according to your configuration file.

In the next step, you will learn how to test if the configuration was well done and where you can see the build logs.

Step 3 — Testing 

To see if the integration with Travis is working properly, you should found your projects in the left menu of Travis dashboard. Click on the project you want to see the build status and push some changes to your GitHub repository. It should show that your commit is building like the one below. As you can see in the image, the logs appear right below the build status of your latest commit. Your build status should be building for recent commits.

Commit Dashboard page

After some time, the automatic build should end and your commit status should have the passed status and look like the one below.

Passed commit on Travis current build page

At this same page, you can check your entire build history and see exactly which commit your project passed and which failed. In the example below, you can check that the commit #48 was the last one to fail, followed by successful ones.

Build history page


The continuous build with Travis is now ready and you have a professional app. You can explore the complete Travis Documentation for more references.

Feel free to reach out to us through our website chat if you have any questions.

What is Travis CI?

Travis CI is a hosted, distributed, continuous and effective integration service, which is being used to develop and test software hosted on GitHub. This service can let you automate all your software tasks including developing, deploying and testing with consistent integrations of technical aspects.

What are essentials to use Travis CI?

Before starting working with Travis CI, you need to have the following things:

-Installed Android Studio, preferably latest version 
-As Travis CI works with GitHub repositories only, so, you need to create a GitHub account too. 
-Cloud code development know how with the Control system of Git version. 

What are steps to use Travis CI?

Here are essential steps you need to follow to use Travis CI:

-Sign up to Travis CI to create and set up a Travis CI account. 
-Create a configuration file 
-Test to check whether Travis integration is working or not.

Leave a reply

Your email address will not be published.