android-emulator-runner icon indicating copy to clipboard operation
android-emulator-runner copied to clipboard

Emulator does not start when multiple android devices are connected

Open dsouzadarryl opened this issue 3 years ago • 0 comments

Hi,

I am using android-emulator-runner to run UI tests on the self hosted runner (mac/x64) for Github action. The machine already has few android devices connected via USB for running few end to end tests. Therefore running UI tests fails to launch the emulator with the below error.

Launch Emulator
  /bin/sh -c \printf 'hw.cpu.ncore=2
  ' >> /Users/macbeast/.android/avd/test.avd/config.ini
  Starting emulator.
  /bin/sh -c \/Users/macbeast/Library/Android/Sdk/emulator/emulator -avd test -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none &
  ERROR   | Unknown AVD name [test], use -list-avds to see valid list.
  ERROR   | ANDROID_AVD_HOME is defined but there is no file test.ini in $ANDROID_AVD_HOME
  ERROR   | (Note: Directories are searched in the order $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/avd and $HOME/.android/avd)
  INFO    | Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)
  /Users/macbeast/Library/Android/Sdk/platform-tools/adb shell getprop sys.boot_completed
  * daemon not running; starting now at tcp:5037
  * daemon started successfully
  adb: more than one device/emulator
  The process '/Users/macbeast/Library/Android/Sdk/platform-tools/adb' failed with exit code 1

It would be great if all the adb commands specify the emulator instance adb -s emulator-5554 like you do in killEmulator() method.

Cheers

dsouzadarryl avatar Nov 22 '22 02:11 dsouzadarryl