isuPatches isuPatches - 1 year ago 268
Android Question

Travis CI with Android Lib - No compatible devices connected

I'm currently trying to get a travis.yml that works for Android 24 / build tools 24.0.3 and having some trouble.

I have the following for my travis.yml:

language: android
sudo: required
jdk: oraclejdk8

- ${TRAVIS_BUILD_DIR}/gradle/caches/
- ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/

- ANDROID_ABI=armeabi-v7a
- ANDROID_TAG=google_apis
- ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)

- tools # to get the new `repository-11.xml`
- platform-tools
- tools # to install Android SDK tools 25.1.x
# For Google APIs
- addon-google_apis-google-$ANDROID_API_LEVEL
# 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-google_apis-$ANDROID_API_LEVEL

- echo no | android create avd --force -n test -t "android-"$ANDROID_API_LEVEL --abi $ANDROID_ABI --tag $ANDROID_TAG
- emulator -avd test -no-skin -no-window &
- android-wait-for-emulator

- ./gradlew clean jacocoDebugTestReport

My current issue is that I keep getting:

: No compatible devices connected.[TestRunner] FAILED Found 1 connected device(s), 0 of which were compatible. :app:connectedDebugAndroidTest FAILED


No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.

which are two completely separate error states.

Does anyone see anything glaringly wrong or incorrect about my travis.yml that could help explain why it's not working.

Answer Source

Add travis_wait followed by the desired minutes to wait to fix the second issue.

  - echo no | android create avd --force -n test -t "android-"$ANDROID_API_LEVEL --abi $ANDROID_ABI --tag $ANDROID_TAG
  - emulator -avd test -no-skin -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

  - travis_wait 20 ./gradlew clean jacocoDebugTestReport

If you fix the first issue, probably you wont need the previous solution.

The line below is normally necessary, I didn't test it on android-24 and I would need to see a full log

  - adb shell input keyevent 82 &

As a workaround, I would use a lower API level as suggested here until you find a better solution.

I have spent a lot of free time the last two years trying to find solutions to this type of issues and the best you can do is to use ci builds for lower APIs and devices or local tests for recent APIs.

The benefits of using latest APIs are not enough if you consider the time required to solve issues.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download