Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native run on multiple simultaneous Android emulators

I would like to test my app on at least 2 Android emulators simultaneously. I can start 2 emulators but can't seem to find how to react-native run-android my app on 2 emulators with ADB. If possible I would also like to be able to run a react-native log-android on each one while testing my app.

Is there a way to do so ?

like image 268
Antoine Auffray Avatar asked Aug 09 '17 10:08

Antoine Auffray


People also ask

How can I run two Android emulators at the same time?

You can run multiple emulators at the same time simply by running your app again. When the AVD manager pops up, instead of selecting your already running emulator, click 'Launch Emulator' and select another emulator to launch. Thank you for the answer!


2 Answers

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

like image 132
Anusha Avatar answered Nov 02 '22 20:11

Anusha


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

like image 29
Burhan Yılmaz Avatar answered Nov 02 '22 19:11

Burhan Yılmaz