Skip to content
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

Race condition causing "No emulators or devices found" for Android #635

Open
YoranBrondsema opened this issue Nov 11, 2019 · 1 comment
Open

Comments

@YoranBrondsema
Copy link
Contributor

Hi,

I'm trying to set up my new Ember.js project with Android. And I came upon the same issue described here and it looks like there's some race condition going on.

I don't have a device connected, only a single emulator. With the following lines in lib/commands/start.js as they are now:

if (platforms.includes('android')) {
  promises.push(listAndroidDevices());
  promises.push(listAndroidEmulators());
}

it finds my emulator about 10% of the time when running corber start. The other 90% of the time, it outputs No emulators or devices found.

However, when I ask it to list the emulators before the devices:

if (platforms.includes('android')) {
  promises.push(listAndroidEmulators());
  promises.push(listAndroidDevices());
}

it finds the emulator 100% of the time!

So it seems that there's a race condition (or something similar) between the two commands

$ANDROID_SDK_ROOT/emulator/emulator -list-avds (lists emulators)
$ANDROID_SDK_ROOT/platform-tools/adb devices -l (lists devices)

I'm new to Android development so I really don't know what's going on here. Just wanted to document this. Maybe it's an option to run the two commands in serial rather than in parallel? I know it's not ideal without understanding the root cause, but it might offer a solution for some people in the mean time without affecting functionality.

I'm on Linux btw (Ubuntu 18.04).

@alexblom
Copy link
Member

Interesting - thanks for reporting this - and for the detailed repro case :-)

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

No branches or pull requests

2 participants