Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactNative custom port support for run-android command, McAfee workaround

Tags:

react-native

I am trying to configure react native for windows for android app development but I am unable to use port 8081 as it is used by McAfee agent on my laptop. I am able to start node js server on different port (8090)

react-native start --port=8090

But when I run the command:

react-native run-android

I am unable to specify port option. Looks to be that it is hardcoded with 8081.

Is there anyway I can start react-native run-android for custom port(8090) port on windows? I am completely new to reactnative and following below link to configure sample Awesomeproject for android on windows.

https://facebook.github.io/react-native/docs/getting-started.html#content

like image 957
sachin1 Avatar asked Jan 03 '16 17:01

sachin1


1 Answers

There is a small work around for this. Anyone running this on a physical device(or even otherwise) can restart their adb session using a different port.

eg.

react-native start --port=1234

On a different cmd/terminal window.

react-native run-android

After which I am greeted by these messages.

BUILD SUCCESSFUL

Total time: 22.589 secs
Running C:\SDK/platform-tools/adb -s VY0025160560725694 reverse tcp:8081 
tcp:8081

This runs it on default reverse port of 8081, which is blocked by McAfee.

Work around:

adb reverse tcp:8081 tcp:1234

Note: You may have to kill and re-open the app.

Currently I am unable to provide an answer for an emulated device since I do not have one installed on my system. But the steps should be similar.

like image 200
XChikuX Avatar answered Jan 29 '23 14:01

XChikuX