React Native 'hello world' quick start: “could not connect to development server”

前端 未结 6 1925
面向向阳花
面向向阳花 2021-02-18 14:21

I\'m trying to do the react native \'hello world\', and I\'m using usb debugging on my android.

I ran react-native run-android, then react-native sta

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-18 15:10

    adb reverse tcp:8081 tcp:8081 Only works for android 5.0 + for running app on devices with android versions lesser than 5.0 hit following command after npm start is done in Terminal (in app directory folder).

    curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
    

    now run the app, it will work. Only drawback is that every time you make a change you need to fire the command again and run the app again.

提交回复
热议问题