How to setup an emulator running API 25 using a build matrix on Travis CI?

Viewed 1770

I am attempting to setup Travis CI so that it runs instrumentation tests on an emulator running API 25. Travis runs the tests to completion on API 4/10/19, but fails to startup the emulator for API 25, with the following message:

$ echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
Valid ABIs: no ABIs.
Error: Invalid --abi armeabi-v7a for the selected target.

The output of android list targets shows that the API 19 emulator has a Tag/ABI, whereas the API 25 emulator does not:

id: 7 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 4
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/armeabi-v7a

id: 11 or "android-25"
     Name: Android 7.1.1
     Type: Platform
     API level: 25
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.

How can I fix this so that the API 25 emulator launches and runs the tests?

The full .travis.yml file is as follows:

language: android

android:
  components:
    - tools
    - platform-tools
    - tools # appears twice as per Travis docs
    - build-tools-23.0.1
    - build-tools-25.0.2
    - android-4
    - android-10
    - android-19
    - android-23
    - android-25
    - extra-android-m2repository
    - sys-img-armeabi-v7a-android-25

env:
  matrix:
    - ANDROID_TARGET=android-4 ANDROID_ABI=armeabi
    - ANDROID_TARGET=android-10 ANDROID_ABI=armeabi
    - ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
    - ANDROID_TARGET=android-25 ANDROID_ABI=armeabi-v7a

before_script:
  # Create and start emulator
  - android list targets
  - jdk_switcher use oraclejdk8
  - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
  - emulator -avd test -no-skin -no-audio -no-window &
  - adb wait-for-device
  - while [[ `adb shell pm path android` == 'Error'* ]]; do sleep 2; done
  - adb shell input keyevent 82 &

script: ./gradlew --info connectedAndroidTest

sudo: false
1 Answers
Related