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

前端 未结 6 1924
面向向阳花
面向向阳花 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 14:57

    Just another scenario, this error happened to me when I forgot to run react-native start command. I usually follow the steps here when I start new project. The steps in a nutshell are as follows (Android in my case):

    • Start Android Studio -> AVD Manager -> select your aVD and click Start from action
    • inside the directory where you want to create your new project, open your command line and run:

      $ react-native init 
      $ cd 
      $ react-native start  //This is the step that I forgot
      
    • Open a new command prompt and run the following inside the same directory(you just created) to launch the app on your AVD.

      $ react-native run-android
      
    • If everything is set up correctly, you should see your new app running in your Android emulator shortly.

    • You'll find in the file index.android.js in the home directory of your project, the last line contians the App registry using the same name you used in the first command above

提交回复
热议问题