Android: Setup Travis-CI

Datetime:2016-08-23 02:29:16          Topic: Andrew Development           Share

[WIP]

Travis CI is a free continuous integration environment, i.e a container that download everything it needs to build your android project and then builds (and opitionally tests) it, for open source projects.

  1. Create a new Android project using a basic template in Android Studio. I’m using Android Studio 2.1.1.
  2. Create a new github project for that and upload your project there, including the gradle wrapper.
  3. Now goto https://travis-ci.org and login by pressing the login with your github account button.
  4. Click add new repository on travis-ci. Press the sync account button at the top. Now you should be able to enable travis-ci for your new repo by pressing the toggle swich.
  5. In your app/build.gradle file note the BuildToolsVersion you’re using and the targetSdkVersion
  6. Create a file called .travis.yml in your repo and upload it to github

    language: android
     java: oraclejdk8 # We need this if your sdk version is 24
     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-YOUR_NOTED_BUILD_TOOLS_VERSION
    
         # The SDK version used to compile your project
         - android-YOUR_NOTED_TARGET_SDK_VERSION
    
         # Additional components
         #- extra-google-google_play_services
         - extra-google-m2repository
         - extra-android-m2repository
         - addon-google_apis-google-19
    
     script:
       - ./gradlew build

Now refresh https://travis-ci.org/ and you should see your project building eventually.

You can now add a fun button to your README.md showing your project has built via:

[![Build Status](https://travis-ci.org/YOURGHUSERNAMEr/YOURPROJECTNAME.svg?branch=master)](https://travis-ci.org/YOURGHUSERNAMEr/YOURPROJECTNAME)




About List