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 ?
Only you can run 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
Before run emulator , You can write terminal then run.
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 )
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. :)
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.
Start the 1st emulator, eg emulator -avd Nexus_S_API_28
Start the 2nd emulator, eg emulator -avd Nexus_S_API_28_2
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:
使用Genymotion ,你只需要启动 2 个实例并启动它们,就好像只有一个一样( react-native run-android
安装应用程序和react-native start
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.