-
Notifications
You must be signed in to change notification settings - Fork 917
feat: launch emulator during run-android #676
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
feat: launch emulator during run-android #676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
packages/platform-android/src/commands/runAndroid/tryLaunchEmulator.ts
Outdated
Show resolved
Hide resolved
packages/platform-android/src/commands/runAndroid/runOnAllDevices.ts
Outdated
Show resolved
Hide resolved
packages/platform-android/src/commands/runAndroid/runOnAllDevices.ts
Outdated
Show resolved
Hide resolved
packages/platform-android/src/commands/runAndroid/tryLaunchEmulator.ts
Outdated
Show resolved
Hide resolved
packages/platform-android/src/commands/runAndroid/tryLaunchEmulator.ts
Outdated
Show resolved
Hide resolved
packages/platform-android/src/commands/runAndroid/tryLaunchEmulator.ts
Outdated
Show resolved
Hide resolved
packages/platform-android/src/commands/runAndroid/tryLaunchEmulator.ts
Outdated
Show resolved
Hide resolved
packages/platform-android/src/commands/runAndroid/tryLaunchEmulator.ts
Outdated
Show resolved
Hide resolved
Something that bothers me, there is no point in declaring a function as async just to await its return, you are just overwrapping stuff as it already returns a promise. |
Thanks, @Titozzz :) It was redundant, fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last batches of adjustments and I think we're good :)
I wonder if we're able to come up with Genymotion (or other custom emulators I don't know of) support as a followup.
packages/platform-android/src/commands/runAndroid/tryLaunchEmulator.ts
Outdated
Show resolved
Hide resolved
bc7f1f2
to
ba53509
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to test it, but code-wise LGTM 👍 great work @jaysbytes
cc @satya164 would you like to give it a try? :) |
Co-Authored-By: Michał Pierzchała <[email protected]>
d6ea811
to
20bdb48
Compare
Just tested locally and fixed a bug I encountered. Also adjusted the wording around errors, warnings and infos a bit. Once CI is happy, this is good to go |
@thymikee thanks for the help with shipping of this awesome feature 😀 |
Wouldn't it be better if available emulators are shown and asked to select one? |
@a-c-sreedhar-reddy not sure about that. Current behavior matches what we do for iOS. Maybe it's worth to revisit. Can you please create a proposal for that where we can discuss better UX? |
Has this feature been included in a recent release? I didn't see it mentioned in any of the latest release notes |
@jsjoeio Yes. It's available in the latest release. C:\Users\Shan7anu\Desktop\RNProjects\Sample>react-native run-android
|
Woohoo! Thanks for confirming @Shan7anu! |
hello @jayu thanks for adding this feature. unfortunately i seem to be unable to get this to work. for context, android studio is not running at the time i run expected behavior:
actual behavior:
alternatively, i opened up android studio. emulator has not launched yet. i run
actual behavior:
workaround: |
I'm using Linux Mint and getting a similar error
|
Summary:
This PR resolves #142
TLDR;
During
react-native run-android
the first of user's emulators will be launched if there is no any running android device/emulatoremulator -list-advs
to get a list of emulatorsemulator @FIRST_ON_LIST
to run the first available emulatorTest Plan:
react-native run-android
without launched emulator -> emulator is launchingreact-native run-android
with launched emulator -> nothing new happensreact-native run-android
with device connected -> nothing new happensreact-native run-android
without launched emulator, emulator has saved snapshot -> emulator is launching