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

I am trying to customize the native Windows response to the development of Android applications, but I cannot use port 8081, as it is used by McAfee agent on my laptop. I can start the js server node on a different port (8090)

react-native start --port=8090

But when I run the command:

react-native run-android

I cannot specify a port option. It looks like it is hard-coded to 8081.

Is there anyway I can run the reaction-native run-android for the user port port (8090) on Windows? I am completely new to Reactionnative and the following link below to set up Awesomeproject for Android sample on Windows.

https://facebook.imtqy.com/react-native/docs/getting-started.html#content

+7
5

. , ( ), adb, .

.

react-native start --port=1234

cmd/.

react-native run-android

.

BUILD SUCCESSFUL

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

8081, McAfee.

:

adb reverse tcp:8081 tcp:1234

. , .

, . .

+7

RN Android. McAfee 8081. 3 , , .

  • , , 8090 port: react-native start --port=8090.
  • Android (VD), VD: cmd + M , Dev → , "localhost: 8081. Android, .
  • , , - VD 8081 . 8090, -, : adb reverse tcp:8081 tcp:8090

adb reverse.

index.android.js r cmd + M → , VD.

+2

, !. , 8081 McAfee, , 8088

Steps :

1. react-native init myproject(create myproject using react-native cli) then cd myproject(move to myproject)
2. open android studio - ctrl + R => Replace 8081 to 8088 from every file.
3. react-native run-android(simulator should be running).
4. Check your local IP ex : ipconfig in windows will give your IP
5. Check yourIP:8088 in your browser => It wil show(React Native packager is running.)
6. At this time in your simulator you will get 403 forbidden error or package manager not running error
7. Ok, Now you need to point your simulator to 8088 instead of 8081, So on your simulator type cntrl + m  => Dev settings => Debugging => Set IP eg : yourIP:8080
8. Now stop package manager.
9. Now remove .babelsrc from your project.
10. Rerun the react-native run-android(If everything goes fine it will work).

, , , facebook , , 8081 .

: . , .babelsrc. .

+1
source

I found a workaround that works (I'm on Linux, but it should work on Windows as well).

On the “Terminal” tab, from the project root, I run:

react-native start --port=8082

This removes the Node up port 8082 . Then I launch the application using:

react-native run-android

After starting the application, I update the development server URL and port to match the above parameters ( Cf. answer , if you do not know how).

It works!!

0
source

Source: https://habr.com/ru/post/1622638/


All Articles