Getting error when Appium try to launch Android Emulator

For the app automation, I do not want to manually launch an emulator and make it ready, but I would like appium to launch an android emulator itself to make a successful session and then to open the app.

So I tried the below approaches,

  • Setting a desired capability as avd to the client driver instance and passing an existing avd name

  • Starting the appium server programmatically using AppiumServiceBuilder and passing ServerArgument as avd

None of this helps me and it returns error as -
Avd ‘xyz’ is not available. No emulators have been detected on your system

To debug this issue, I made sure of the following:

  • I have couple of emulators already configured in my system.
    Hence running command (emulator -list-avds) from cmd, lists the available avds.
  • The android avd folder is in my system path, hence running command (emulator {emulator name} ) successfully launches the emulator
  • The deviceName is set as → cap.setCapability(“deviceName”, “Android Emulator”);

the error trace is below :

     Encountered internal error running command: Error: Avd 'Pixel_XL_API_30' is not available. No emulators have been detected on your system
 at ADB.checkAvdExist (C:\Users\musaf\AppData\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\tools\adb-emu-commands.js:453:11)
 at ADB.launchAVD (C:\Users\musaf\AppData\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\tools\system-calls.js:786:3)
 at Object.prepareEmulator (C:\Users\musaf\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\lib\android-helpers.js:151:3)
 at Object.getDeviceInfoFromCaps (C:\Users\musaf\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\lib\android-helpers.js:199:5)
 at AndroidUiautomator2Driver.startUiAutomator2Session (C:\Users\musaf\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:327:26)
 at AndroidUiautomator2Driver.createSession (C:\Users\musaf\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:224:7)
 at AppiumDriver.createSession (C:\Users\musaf\AppData\Roaming\npm\node_modules\appium\lib\appium.js:366:35)

System details:

  1. Appium version - v1.19.1
  2. adb version - 30.0.5-6877874

Could not figure out the reason for the issue, and not sure I miss anything here, or its a bug with any of these tool (android sdk, or appium etc). And its the same behavior when tried with Appium Desktop app to have a session or with a client script written using Java.
(when the emulator is launched manually, app automation works great !)
Please let me know if any of you have any clue

Thanks & Warm Regards

Try appium@beta. There was a bug related to emulator config path detection on Windows

1 Like

Thank you @mykola-mokhnach
It did the trick for me :smiley: and it just works now !