Could not connect to development server : ReactNative

Karishma Agrawal
2 min readMay 12, 2020

--

Does this image seem familiar? Most of you have faced this issue when you initially worked with React Native. You might have searched for solutions online, but to no avail.

Know the ‘Why’

First you need to know why this error keeps coming up. Everyone gets this issue because of some or the other mistake. So many different mistakes, all leading to the same error.But the main issue is app is not able to communicate to your bundler server ( mertro).

Following are some of the reasons that can come up to cause the error:

  1. Your ADB is not globally available: This was one of the reasons which had created problems for me. I used to access the adb from the android platform-tools location by typing ./adb command to access it.
    This what you need to do to make it globally available:
    Install brew :
    /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)
    Then enter this command to install platform-tools:
    brew cask install android-platform-tools
    Now check adb devices , it will give you a list of connected devices.
  2. Connection of multiple devices: Enter adb devices command your terminal to a check the list of connected devices. If there are more than one device on the list, your serve gets confused as to which device needs to be connected.
  3. Run the react server before running Android : Before installing APK in your device don’t forget to run react server
    npx react-native start
    npx react-native run-android
  4. Device is not on tcp:8081: This is the most common issue that many will face. Enter the below command to connect your device on tcp:8081 port: adb disconnect. Disconnect all the connected devices first
    adb disconnect. Disconnect all the connected devices first
    adb usb. Connect with a device which is connected through USB
    adb reverse tcp:8081 tcp:8081 to connect it with port 8081
    now run npx react-native run-android in your project folder.
  5. Via Wifi: you can find the android device IP address at Settings > Wi-Fi Settings > Advanced > IP address.
    Enter the following command in Terminal
    adb tcpip 5555
    adb connect <DEVICE_IP_ADDRESS>:5555

Find out what went wrong. Fix it. Keep moving forward!

--

--

Karishma Agrawal

Android Developer @Eventbrite | Wanted to be a writer so I write code now | Reader