Unable to load script from assets index.android.bundle on windows

后端 未结 30 4150
鱼传尺愫
鱼传尺愫 2020-11-22 06:33

I\'m trying to run my first React Native project for first time on my device (Android 4.2.2).

And I get:

unable to load script from assets in

30条回答
  •  天涯浪人
    2020-11-22 07:00

    I had issue with McAfee on my mac blocking port 8081, had to change it to 8082.

    First run your package server:

    react-native start --port 8082
    

    Open another terminal, start the android app as usual:

    react-native run-android
    

    Once it finishes, now rewrite the tcp port that adb tunnels:

    adb reverse tcp:8081 tcp:8082
    

    See the list of adb tcp tunnels:

    adb reverse --list
    

    You should now see a heartwarming message:

    (reverse) tcp:8081 tcp:8082
    

    Go to your app and reload, done!

    PS: Don't change anything in the app Dev settings, if you added "localhost:8082", just remove it, leave it blank.

    EDIT: To all the McAfee victims out there, there's easier solution if you have root access, just temporarily kill the McAfee process sitting on port 8081 and no need for port change at all:

    sudo launchctl remove com.mcafee.agent.macmn
    

提交回复
热议问题