language: android
jdk: oraclejdk7
# Use the Travis Container-Based Infrastructure
sudo: false

cache:
  directories:
    - ${TRAVIS_BUILD_DIR}/gradle/caches/
    - ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/

env:
  global:
    - ANDROID_API_LEVEL=23
    - EMULATOR_API_LEVEL=21
    - ANDROID_BUILD_TOOLS_VERSION=23.0.0
    - ANDROID_ABI=google_apis/armeabi-v7a
    - ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)

android:
  components:
    - platform-tools
    - tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_API_LEVEL
    - android-$EMULATOR_API_LEVEL
    # For Google APIs
    - addon-google_apis-google-$ANDROID_API_LEVEL
    - addon-google_apis-google-$EMULATOR_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
    # Specify at least one system image
    - sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL
    - sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL

before_script:
  # Create and start emulator
  - echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$EMULATOR_API_LEVEL --abi $ANDROID_ABI
  - emulator -avd test -no-skin -no-audio -no-window &
  - android-wait-for-emulator

script:
  - ./gradlew connectedCheck -x library:signArchives -PdisablePreDex