Sunday, January 27, 2019

Solve Could not connect to development server Error in React Native

React Native runs on backhand server which starts when we apply the react-native run-android or react-native run-ios command on our command prompt screen. This command start will build up our Gradle project and start synchronizing the whole package using JS server. So when we close the server window this development server Error occurs.
When you run the android project, then you will see "Could not connect to development server" error message in your android application.

Solve Could not connect to development server Error in React Native

The message with this error should look below :-

Error Message :
Could not connect to development server.

Try the following to fix the issue :

  • Ensure the packager server is running.
  • Ensure your device/ emulator is connected to your machine and has USB debugging enabled – run ‘adb devices’ to see a list of connected devices.
  • Ensure airplane mode is disabled.
  • If you’re on a physical device connected to the machine , run ‘adb reverse tcp:8081’ to forward request from your device.
  • If your device is on the same Wi-Fi network, Set ‘Debug server host & Port for device’ in ‘Dev settings’ to your machine IP address and the port of your local Dev server – e.g. 10.0.1.1:8081.

How to Solve Could not connect to development server Error in React Native :

Step-1 : First run the below command in terminal or command prompt
react-native run-android

Step-2 : Then run the below command in terminal.
react-native start

Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section.

No comments:

Post a Comment