Home » Android » Travis Android Emulator >= 23 does not work

Travis Android Emulator >= 23 does not work

Posted by: admin November 1, 2017 Leave a comment

Questions:

I’m trying to run an emulator with API >= 23 on Travis CI and so far I haven’t had any luck. This is my configuration file:

before_install:
  - pip install --user codecov
  # Install SDK license so Android Gradle plugin can install deps.
  - mkdir "$ANDROID_HOME/licenses" || true
  - echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
  # Install the rest of tools (e.g., avdmanager)
  - sdkmanager tools
  # Install the system image
  - sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
  # Create and start emulator for the script. Meant to race the install task.
  - echo no | avdmanager create avd --force -n test -k "system-images;android-25;google_apis;armeabi-v7a"
  - $ANDROID_HOME/emulator/emulator -avd test -no-skin -no-audio -no-window &

install: ./gradlew clean assemble assembleAndroidTest --stacktrace

before_script:
  - android-wait-for-emulator
  - adb shell input keyevent 82

script: ./gradlew check connectedCheck --stacktrace

At build time I’m getting the following exception:

com.android.builder.testing.ConnectedDevice > runTests[test(AVD)] FAILED

com.android.builder.testing.api.DeviceException:
com.android.ddmlib.InstallException: Failed to establish session

at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:144)

[no message defined]

com.android.builder.testing.api.DeviceException:
com.android.ddmlib.InstallException: Failed to establish session

Has anyone been able to run Travis with an Emulator >= 23?

Answers: