【问题标题】:Travis-CI Android tests with Gradle keep timing out使用 Gradle 的 Travis-CI Android 测试不断超时
【发布时间】:2014-10-30 01:15:19
【问题描述】:

我正在尝试在 Travis CI 上构建和测试我的项目。它每次都在我的所有存储库上向我显示相同的重复输出。

这是我的 travis.yml https://github.com/carts-uiet/cartsbusboarding/blob/master/.travis.yml

language: android
    android:
    components:
    # Uncomment the lines below if you want to
    # use the latest revision of Android SDK Tools
    # - platform-tools
    # - tools
    # The BuildTools version used by your project
    - build-tools-21.0.0
    # The SDK version used to compile your project
    - android-21
    # Additional components
    - add-on
    - extra
    # Specify at least one system image,
    # if you need to run emulator(s) during your tests
    - sys-img-armeabi-v7a-android-21
    # Emulator Management: Create, Start and Wait
    before_script:
    - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
    - emulator -avd test -no-skin -no-audio -no-window &
    - android-wait-for-emulator
    - adb shell input keyevent 82 &

这是一个这样的构建https://travis-ci.org/carts-uiet/cartsbusboarding/builds/39447907

$ javac -version
javac 1.7.0_60
before_script.1
3.53s$ echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
Android 5.0 is a basic Android platform.
Do you wish to create a custom hardware profile [no]Created AVD 'test' based on Android 5.0, ARM (armeabi-v7a) processor,
with the following hardware config:
hw.cpu.model=cortex-a8
hw.lcd.density=240
hw.ramSize=512
vm.heapSize=48
before_script.2
0.01s
$ emulator -avd test -no-skin -no-audio -no-window &
$ android-wait-for-emulator
Failed to Initialize backend EGL display
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
error: device offline
error: device offline
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: device offline
error: device offline
running
running
running
running
running
running

所有这些构建超时。

我在这里做错了什么?

【问题讨论】:

    标签: android android-gradle-plugin travis-ci


    【解决方案1】:

    更新响应: VM 映像已包含固定的 android-wait-for-emulator 脚本和 android SDK 工具版本 24.0.0,默认情况下可解决此问题。我删除了我过时的回复和解决方法。

    Build Environment Updates - 2014-12-09

    【讨论】:

    • 非常感谢@Ardok 你是救命稻草 :)
    • 不客气,解决方案即将推出android-review.googlesource.com/#/c/112780
    • 新的android-wait-for-emulator已经修复,大家可以试试。我更新了响应。
    【解决方案2】:

    这听起来像是获取最新版本脚本的最佳选择:

    我在之前的脚本中添加了这个:

    # Emulator Management: Create, Start and Wait
    before_script:
      - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
      - emulator -avd test -no-skin -no-audio -no-window &
      - curl http://is.gd/android_wait_for_emulator > android-wait-for-emulator
      - chmod u+x android-wait-for-emulator
      - ./android-wait-for-emulator
      - adb shell input keyevent 82 &
    

    url 指向 github 上可用的最新脚本。

    希望对您有所帮助。 . .

    【讨论】:

      【解决方案3】:

      您需要指示您的 travis 构建实际运行单元测试:

      # run tests  against the emulator
      - ./gradlew connectedAndroidTest
      # run tests  against the JVM
      - ./gradlew test
      

      【讨论】:

        猜你喜欢
        • 2015-01-04
        • 2015-04-06
        • 1970-01-01
        • 2018-06-03
        • 2015-10-18
        • 2016-05-09
        • 2017-02-16
        • 1970-01-01
        • 2017-11-12
        相关资源
        最近更新 更多