React Native run on multiple simultaneous Android emulators

In order to run your react application on multiple emulators, just start 2 emulators as usual and then use the command react-native run-android.

You can even specify any port number as react-native run-android --port 8084 if you want. Your app will start on both the emulators simultaneously. :)

Have a look here


The accepted answer by @Burhan Yılmaz did NOT work for me. This is probably due to new updates and development in the relevant software. The following steps demonstrate what worked for me.

  1. Start the 1st emulator, e.g. emulator -avd Nexus_S_API_28

  2. Start the 2nd emulator, e.g. emulator -avd Nexus_S_API_28_2

  3. Start React-Native in the same way, which you would usually use (without specifying any ports.) react-native run-android

This sends a copy of the code to both devices. However, each device runs its copy in isolation from the other device.

Environment Details:

  • MS Windows 10
  • Android SDK 29.0.2
  • React-Native: 0.61.2

You can only do it on different ports. Because one port, one listener :/
Solve:

react-native start --port 9988
./emulator -port 9988 -avd devicename1

react-native start --port 9999
./emulator -port 9999 -avd devicename2

Edit2:

Before running the emulator, You can write in the terminal and then run it:

function emulator { cd "$(dirname "$(which emulator)")" && ./emulator "$@"; }

First emulator is react .

emulator -port 9988 @react
react-native run-android ( automaticaly detect emulator )

Second emulator is r .

emulator -port 8081 @r
react-native run-android (automaticaly detect emulator )

enter image description here