-
Notifications
You must be signed in to change notification settings - Fork 935
Description
Describe the Feature
be able to run react-native run-android --emulator MyEmulatorName
After shipping #676 we are able to start an android emulator during run-android.
Cli will start a new emulator if there isn't any device available. The drawback of the current solution is that it tries to start the first emulator from the list returned by emulator -list-avds. It would be usefull to be able to run the app on a specific emulator, even if there are other devices connected. It could work similarly to the deviceId flag. We could add an emulator flag followed with the emulator name.
Possible Implementations
This implementation has several edge cases worth discussing, but we will need the following to achieve the goal
Get the emulator names based on deviceId
- use
adb.getDevicesimplemented inrun-androidto get list of currently running devices - Look for
deviceIdswith patternemulator-PORT_NUMBER - Map found
deviceIdsto emulator names usingadb -s emulator-PORT_NUMBER emu avd name
Modify tryLauchEmulator to accept the emulator name as a param
Then if an emulator is running, launch the app using tryLaunchAppOnDevice
If the emulator is not running, lunch it and then check once again for adb.devices to get it's deviceId, then tryLaunchAppOnDevice