Android tool test not working on Travis CI AVD, but working on local emulator

If I run control tests on my local emulator, they work fine 10 out of 10 times, but when I try to run the same tests on AVD in Travis CI, I accidentally get

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.

I tried to remove all progress bars and everything, but still this is a problem that happens only randomly and on Travis. My travis.yml is as follows:

 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 
+8
android travis-ci android-avd instrumentation
source share
1 answer

If you want to use the android-wait-for-emulator script, removing the -no-boot-anim parameter depends on to determine when the emulator is ready.

Alternatively, replace the android-wait-for-emulator script with a fixed sleep time as follows:

  - sleep 300 - adb shell input keyevent 82 & 

You need to choose a sleep time based on each API loading time.

0
source share

All Articles