javascriptandroidandroid-emulatorreact-native

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 ?


Solution

  • 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