Skip to content

AVDsResolver not able to find exact emulator on Windows machine #4775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
dude3133 opened this issue May 29, 2025 · 3 comments · Fixed by #4776
Closed
2 tasks done

AVDsResolver not able to find exact emulator on Windows machine #4775

dude3133 opened this issue May 29, 2025 · 3 comments · Fixed by #4776

Comments

@dude3133
Copy link

Did you test using the latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test fail and you're not sure why?

  • I have read the troubleshooting guide and it didn't help me.

What happened?

Running detox test --configuration android.emu.debug fails with correct emulator name with error message:

DetoxRuntimeError: Cannot boot Android Emulator with the name: 'a15'

  ,w14r Make sure you choose one of the available emulators: A9

Running emulator list returning this device, so it's not an issue with missing device:

>emulator -list-avds
A9
a15
w14r

Since issue is reproducing only on Windows machine, I assume it's related to AVDResolver using LF instead of CRLF for splitting device names

What was the expected behaviour?

Expected to work with device in place and all environment variables set up

Help us reproduce this issue!

To avoid issue quick fix should work:

const { ListAVDsCommand } = require('../../../../common/drivers/android/emulator/exec/EmulatorExec');
const { EOL } = require('os');

class AVDsResolver {
  constructor(emulatorExec) {
    this._emulatorExec = emulatorExec;
  }

  async resolve() {
    const output = await this._emulatorExec.exec(new ListAVDsCommand());
    const avds = output.trim().split(EOL); // Using OS native end of line to split emulators list
    return avds;
  }
}

module.exports = AVDsResolver;

In what environment did this happen?

Detox version: "^20.39.0"
Test-runner (select one): jest

Detox logs

Detox logs
● Test suite failed to run
                                                                                                                                                        
    ,w14rRuntimeError: avds:A9

    HINT: avdName:a15

      at AVDValidator._assertAVDMatch (node_modules/detox/src/devices/allocation/drivers/android/emulator/AVDValidator.js:38:13)
      at AVDValidator.validate (node_modules/detox/src/devices/allocation/drivers/android/emulator/AVDValidator.js:18:16)
      at async EmulatorAllocDriver.allocate (node_modules/detox/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js:59:5)
      at async C:/Projects/PROJECT_NAME/node_modules/detox/src/devices/allocation/DeviceAllocator.js:44:22

Device logs

Device logs
paste your device.log here!

More data, please!

No response

@JB712
Copy link

JB712 commented Jun 2, 2025

Same with [email protected] and [email protected]

The solution proposed above manages to launch the emulator, but still fails tests because it can't connect to the emulator (perhaps due to console errors when launching the emulator, and tries to restart the emulator for each test).

@noomorph
Copy link
Collaborator

noomorph commented Jun 3, 2025

Thanks for the report.

@noomorph
Copy link
Collaborator

noomorph commented Jun 3, 2025

@JB712 if you revert Detox to 20.34.4 and monkey patch AVD resolver like this #4776 — do you see the problem reoccurring still?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants