APK errors

Red screen: cannot reach Metro

Error text

Could not connect to development server.
Try the following to fix the issue:
• Ensure that Metro is running
• Ensure that your device/emulator is connected to your machine and has USB debugging enabled

Cause

The debug app cannot reach the development server (Metro). The server is off, the port is blocked, or the device is on another network.

Step-by-step fix

  1. Check that Metro runs in the terminal: npx react-native start.
  2. For a USB device run adb reverse tcp:8081 tcp:8081.
  3. Over Wi-Fi keep the phone and the computer on the same network.
  4. If the network gets in the way, use npx expo start --tunnel.
  5. Let the firewall keep port 8081 open.

Example commands

adb reverse tcp:8081 tcp:8081
npx react-native start --port 8081
adb devices
npx expo start --tunnel

How to prevent it

Keep other programs off the same port; run Metro in one dedicated terminal.

Author and license: Nibras Code