2014-10-30 102 views
6

我正在嘗試構建&在Travis CI上測試我的項目。每次在我所有的存儲庫中都會顯示相同的重複輸出。Travis-CI Android測試使用Gradle保持超時

這裏是我的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 

所有這些建立超時。

我在這裏做錯了什麼?

回答

2

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

Build Environment Updates - 2014-12-09

+0

非常感謝@Ardok 你節省:) – 2014-10-31 12:20:54

+0

歡迎您,解決方案即將推出HTTPS生活:// android-review.googlesource.com/#/c/112780/ – albodelu 2014-10-31 16:57:56

+0

新的android-wait-for-emulator已經修復,你可以嘗試使用它。我更新了回覆。 – albodelu 2014-11-07 19:53:05

1

這聽起來像的最佳替代品,以獲得最新版本的腳本:

我說這個我之前的腳本:

# 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上可用。

希望有所幫助。 。 。

+0

不再有效(網址返回404) – spy 2017-09-04 20:45:09

1

你需要你的指導特拉維斯構建實際運行單元測試:

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