簡體   English   中英

使用Gradle的Travis-CI Android測試可以防止超時

[英]Travis-CI Android tests with Gradle keep timing out

我正在嘗試在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

所有這些都構建了超時。

我在這做錯了什么?

更新的響應: VM映像已經包含固定的android-wait-for-emulator腳本和android SDK工具版本24.0.0,默認情況下解決了這個問題。 我刪除了過時的響應和解決方法。

構建環境更新 - 2014-12-09

這聽起來像是獲取最新版腳本的最佳選擇:

我在前腳本中添加了這個:

# 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上提供的最新腳本。

希望有所幫助。

您需要指示您的travis構建實際運行單元測試:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM