2016-09-22 73 views
8

如果我在本地模擬器上運行儀器測試,他們十次運行10次,但是當我嘗試在Travis CI中的AVD上運行相同的測試時,隨機獲得Android儀器測試在Travis CI AVD上失敗,但在本地模擬器上工作

FAILED java.lang.RuntimeException: Could not launch intent Intent { } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was xxxxxxx and now the last time the queue went idle was: xxxxxxxxx. If these numbers are the same your activity might be hogging the event queue.

我試圖消除所有的進度條和一切,但仍然是其一個問題,只是發生的隨機和特拉維斯。 我travis.yml看起來是這樣的:

env: 
    global: 
    - ANDROID_TARGET=android-19 
    - ANDROID_ABI=armeabi-v7a 
    before_script: 
     - android list targets 
     - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI 
     - emulator -avd test -no-skin -no-audio -no-window -no-boot-anim & 
     - android-wait-for-emulator 
     - adb shell input keyevent 82 & 
    script: 
     - ./gradlew jacocoTestReport assembleAndroidTest connectedCheck zipalignRelease 

回答

0

如果你想使用android-wait-for-emulator腳本,請remove-no-boot-anim選項它depends on檢測時模擬器已準備就緒。

另外,通過固定sleep time這樣更換android-wait-for-emulator腳本:

- sleep 300 
    - adb shell input keyevent 82 & 

您需要選擇基於每個API開機時間睡眠時間。

相關問題