Testing with the Android emulator on CircleCI

CircleCI supports running the Android emulator through our new Android machine image that supports x86 Android emulator tests and nested virtualization. Documentation on how to access it is available here: https://circleci.com/docs/2.0/android-machine-image/. We also recommend using the circleci/android orb in your config as it provides useful commands for emulator testing.

 

Note: The Android machine image is different from the Android docker convenience images, which do not support emulators

 

Common causes of failed UI tests when using the emulator on Android machine image

- Insufficient memory

We recommend using at least a resource class of at least "large" and above, as "medium" is usually insufficient to run the emulator and gradle processes.

- Emulator configuration

Higher API levels and/or system images that come with Google APIs installed have been observed to be less stable, or require specific emulator options (e.g. no-window to be enabled/disabled). If UI tests are failing, we recommend trying out both system images "system-images;android-29;default;x86" and "system-images;android-29;default;x86_64" to see if the tests will pass with either, as these 2 system images are observed to be relatively more stable.

Certain tests may also require emulator capabilities, e.g. Google/Playstore APIs, or the camera, to be present.

- Emulator animations

We recommend disabling of emulator animations to prevent interference with tests. This can be done through this orb command, disable-animations , or other commands from the orb that wrap it.

- Flakiness

Some degree of flakiness may be expected from the emulator. We recommend using our android orb command, run-tests, (or other commands from the orb that wrap it, like start-emulator-and-run-tests) to run your tests with, as it supports retries

 

 

Was this article helpful?
27 out of 49 found this helpful

Comments

0 comments

Article is closed for comments.