Anthon Santhez
Anthon Santhez

Reputation: 444

Is it possible to run 2 different apps in 2 different emulators simultaneously?

Is it possible to run 2 different react-native projects in 2 different android emulators simultaneously? I mean for testing purposes. If possible how?

I tried to run with different emulators and with different metro ports, but second app builds very very slowly and while building it gives so many lines of errors and later finishing the build. When the second app launches on second emulator, this error comes on the emulator screen:

typeeror: null is not an object (evaluating'_ReanimatedModule.default.createNode'), stack:
__nativeInitialize@453633:35
__attach@453569:31
AnimatedParam@455046:20
createAnimatedParam@455130:28
createAnimatedFunction@454983:93
<unknown>@454815:124
loadModuleImplemetation@290:13
......
...... (so on)

And also react-native start doesn't recognize the second emulator. When reload, it says

"No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB."

I think after some edits, it will be possible but how?

Env: Windows 10 Vscode React-native

Upvotes: 1

Views: 546

Answers (1)

Sally Azulay
Sally Azulay

Reputation: 441

Try this:

  1. First list devices that you are using

adb devices example: emulator-5554 device emulator-5556 device

  • Running react-native apps on different ports .

  • react-native run-android --port 8081 --deviceId emulator-5556

  • react-native run-android --port 8088 --deviceId emulator-5554

** By default the emulator-5554 will try to run on 8081, and will show error. Do the next step.

  • The default port is 8081 so , we do not need to do extra thing after this for emulator-5556. Do the next step for emulator-5554

  • Change the server and port number in Dev-settings

  • go to dev-setting in react-native app [ Command + M in Mac and Ctrl + M in windows.

** Under Debugging section for emulator-5556, in Debug server host & port for device :

  • List item

  • change it to localhost:8088

** This will change the app to listen to metro-bundler in localhost: 8088.

reference to this Link

Upvotes: 1

Related Questions