docker-android icon indicating copy to clipboard operation
docker-android copied to clipboard

Support for Instrumented tests

Open eugenio1590 opened this issue 5 years ago • 3 comments

I am using this docker to run the unit tests in an android project. It is worked very well. But I need support to run the expresso tests with that docker.

Currently, I have three steps for doing it:

  1. Install KVM (I am not sure about this steps)
- apt-get --quiet install --yes libx11-dev libpulse0 libgl1 libnss3 libxcomposite-dev libxcursor1 libasound2
- apt-get --quiet install --yes qemu-kvm libvirt-daemon-system libvirt-dev libvirt-clients virtinst bridge-utils
  1. Get the android-wait-for-emulator
- wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
- chmod +x android-wait-for-emulator
  1. Create the emulator and wait for it to be ready to run the tests.
- echo no | android-sdk-linux/tools/bin/avdmanager create avd -n test -k "system-images;android-${ANDROID_EMULATOR_VERSION};google_apis;x86"
- android-sdk-linux/emulator/emulator -avd test -accel auto -gpu auto -no-window -no-audio &
- ./android-wait-for-emulator
- adb shell input keyevent 82

eugenio1590 avatar Dec 04 '19 14:12 eugenio1590

were you able to solve the problem?

Syne10 avatar Aug 13 '20 10:08 Syne10

were you able to solve the problem?

I am sorry but I couldn't resolve it.

eugenio1590 avatar Aug 13 '20 14:08 eugenio1590

Hey @eugenio1590! This issue has been open for quite a while, and I'm sorry that I didn't respond for so long. I'm trying to figure out what your actual need is here.

The script android-wait-for-emulator already is included in all of these images, as is at least one system image in the xx-system variants: https://github.com/mreichelt/docker-android/blob/master/minimal.Dockerfile#L20-L22

And as far as I remember, I actually set everything up in the images for the emulators to be run successfully.

What is missing for you to be able to start the emulator?

As far as I know, KVM actually has to be installed on the Linux host machine (rather than the Docker guest), and the /dev/kvm device has to be mounted into the guest from the outside for the emulator to actually work. This thread on StackOverflow describes how.

I'd love to know how I can help!

mreichelt avatar Apr 03 '21 21:04 mreichelt