Emulator is freezing while running the automation suite

android
circle.yml

#1

Hi ,

I am running android automation as soon as new code is pushed in the git.

I have used basic circle.yml configuration. Sometimes tests are running slowly, Sometimes they freeze. Its kind of unpredictable.

Please help me in this regard.

Here is my Circle.tml config.

machine:
    environment:
        GRADLE_OPTS: -Xmx1024m -XX:MaxPermSize=1024m

general:
#artifacts:
#    - /home/ubuntu/app/build/outputs/apk/
  branches:
    only:
      - app/automation/master

#dependencies:
#  pre:
#     - echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
#     - echo y | android update sdk --no-ui --all --filter "extra-android-support"

test:
  pre:
    - android list target
    - echo no |android create avd -n my_android4.4.2 -t 6 --abi default/armeabi-v7a
    - emulator -memory 2048 -avd my_android4.4.2 -gpu on -no-audio -no-window:
        background: true
        parallel: true
    - circle-android wait-for-boot

  override:
    - ./gradlew assembleDebug connectedAndroidTest:
         timeout: 7200
  post:
    - cp -r app/build/outputs $CIRCLE_ARTIFACTS
    - cp -r app/build/reports/androidTests/connected/* $CIRCLE_TEST_REPORTS

#2

Hi there,

I know it’s been a while since your post, but I have a suggestion for you or anyone in a similar situation. If you’re stuck debugging a frozen test on the emulator, I highly recommend connecting to the build machine via VNC. UI testing tools can freeze for all kinds of reasons. A couple that come to mind:

  • a race condition (i.e. trying to click an element before it’s rendered, then waiting for a change that will never happen)
  • an unexpected UI block (i.e. an alert window popping up over the next interaction element)

With VNC debugging, you want to re-run your UI test again and make sure you can watch it happen (so get rid of the -no-window flag above).


#3

Thanks Eric. I will certainly try it out the next time when the need will arise.

Last time CirclCI said that It was mostly due to low ram or some memory issue.

I had to debug this in my own local system with the exact same emulator config.


#4

Hi Eric,

I’ve set up the VNC according to the instructions, but I still can’t see any android emulator pop up - either when circle runs the

emulator -avd circleci-android22 -no-boot-anim -no-audio:
        background: true
        parallel: true

command or I do it from inside the VNC.

Am I missing something?


#5

Before starting android emulator, did you run this?

export DISPLAY=:1.0

This tells Android to use the VNC display instead of the X headless display.


#6