Adb reverse gives the error: more than one device/emulator

When debugging a ReactNative app on a physical Android device, one can get an error that the device cannot connect to Metro.

Usually, the error is related to the port forwarding not being set up (the laptop port 8081 should be exposed to the device port 8081).

When you have more than 1 device connected (like one emulator and one physical device), the port reversing will not work and will give you the more than one device/emulator error.

In this case, you need to:

  1. Run the adb devices command to list all the connected devices
    Example output:
    List of devices attached
    760023010483 device
    emulator-5554 device
  2. Do the reverse command for the specific device you want to run your app on
    adb -s 760023010483 reverse tcp:8081 tcp:8081

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.