language: android

android:
  components:
    - tools
    - tools
    - platform-tools
    - build-tools-29.0.2
    - android-29

script:
  ./gradlew build test

jdk:
  - oraclejdk8

sudo: false

before_install:
  - yes | sdkmanager "platforms;android-29"

cache:
  directories:
    - $HOME/.m2

language: android
dist: trusty

jdk:
  - oraclejdk8

env:
  global:
    - ADB_INSTALL_TIMEOUT=8
    - ANDROID_ABI=x86_64
    # Use google_apis flavor if no default flavor emulator.
    - EMULATOR_FLAVOR=default
    # PATH order is incredibly important. e.g. the 'emulator' script exists in more than one place!
    - ANDROID_HOME=/usr/local/android-sdk
    - ANDROID_TOOLS=${ANDROID_HOME}/tools
    - PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${ANDROID_TOOLS}:${ANDROID_TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
  matrix:
    - ANDROID_API=21

android:
  components:
    - tools
    - tools
    - platform-tools
    - build-tools-29.0.2
    - android-29

before_cache:
  - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

cache:
  directories:
    - $HOME/.m2
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/

install:
  # Mute sdkmanager warning.
  - echo 'count=0' > /home/travis/.android/repositories.cfg
  # We need the API of the emulator we will run.
  - echo y | sdkmanager "platforms;android-$ANDROID_API" >/dev/null
  - echo y | sdkmanager "emulator" >/dev/null
  - echo y | sdkmanager "system-images;android-$ANDROID_API;$EMULATOR_FLAVOR;$ANDROID_ABI" >/dev/null
  - echo no | avdmanager create avd --force -n test -k "system-images;android-$ANDROID_API;$EMULATOR_FLAVOR;$ANDROID_ABI" -c 10M
  - emulator -verbose -avd test -no-accel -no-snapshot -no-window $AUDIO -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

script:
  - ./gradlew build
  - ./gradlew connectedCheck

Support running integration tests on Travis CI
Support running integration tests on Travis CI
