Android tests fail on Travis with ShellCommandUnresponsiveException

后端 未结 1 683
盖世英雄少女心
盖世英雄少女心 2020-12-05 10:54

We\'re seeing a lot of build failures on the first and even second execution of pull requests for our Android project on Travis. However, if we restart the exact same build

相关标签:
1条回答
  • 2020-12-05 11:10

    You can set the environmental variable ADB_INSTALL_TIMEOUT on Travis to a value such as 8 minutes to avoid this problem.

    For example, in your .travis.yml:

    language: android
    jdk: oraclejdk7
    # Turn off caching to avoid any caching problems
    cache: false
    # Use the Travis Container-Based Infrastructure
    sudo: false
    env:
      global:
        - ANDROID_API_LEVEL=21
        - ANDROID_BUILD_TOOLS_VERSION=21.1.2
        - ANDROID_ABI=armeabi-v7a
        - ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
    
    android:
      components:
        - platform-tools
        - tools
        - build-tools-$ANDROID_BUILD_TOOLS_VERSION
        - android-$ANDROID_API_LEVEL
    

    The ShellCommandUnresponsiveException is related to AOSP issue 69735: Ddmlib is too agressive with timeouts in Device.java, which causes ddmlib to timeout quickly if it doesn't receive input. The above environmental variable extends this timeout period on the Travis VM.

    Also please be sure you're using the latest API level SDK and Build tools (at least the version above), since earlier versions don't allow setting this environmental variable.

    Note that this may only resolve your problem if your tests occasionally pass on Travis - if your build always fails you may have other problems going on.

    EDIT March 2016

    Note that if you're still seeing failures, especially on API Level 23 emulator, there is another emulator timeout issue that may be causing you problems.

    To get around this, you'll need to update your Gradle plugin to at least 2.0.0-beta3 - for example:

    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-beta5'
    }
    

    For details see:

    • Gradle commands fail on API 23 Google API emulator image (armeabi-v7a)
    • https://code.google.com/p/android/issues/detail?id=190200
    • https://code.google.com/p/android/issues/detail?id=189764
    0 讨论(0)
提交回复
热议问题