Search code examples
androidpythonunit-testingadbtravis-ci

Is there a way to start android emulator in Travis CI build?


I have python wrapper-library for adb where I have unit-test which depend on emulator or real device (since they execute adb commands).

I want also to use Travis CI as build environment along with executing those unit tests for each build.

Is there a way to have android emulator available somewhow in Travis CI, so that unit tests can execute adb commands?

Thanks in advance!


Solution

  • According to the Travis CI documentation, you can start an emulator with the following script in your .travis.yml:

    # Emulator Management: Create, Start and Wait
    before_script:
      - echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
      - emulator -avd test -no-skin -no-audio -no-window &
      - android-wait-for-emulator
      - adb shell input keyevent 82 &
    

    Just specify the system image you need in components.