11

I execute the project with react-native run-android and in another terminal, i do:

npm run react-devtools

and it opens the new window of electron that says:

The react native app it will open in a few seconds...

but nothing happens.

I put in the simulator toggle inspector with Ctrl + m and i can see in networks that it makes a request to http://localhost:8097 and the result is it fails to connect and keeps trying with the same result.

The window of electron that is open it says that it wait connections to the port 8097 so i can see is trying to connect but with no results!

MohamadKh75
  • 2,582
  • 5
  • 28
  • 54
Franco Coronel
  • 710
  • 1
  • 12
  • 25

4 Answers4

30

You need to run this command in a new terminal adb reverse tcp:8097 tcp:8097

toxdes
  • 421
  • 4
  • 8
  • 1
    Note that, though some docs say this is only necessary when *not* using local simulators, it is also necessary with some local simulators, specifically Android 12 simulators, which restrict port forwarding. – Andrew Aug 01 '22 at 10:53
5

react-devtools v4 is incompatible with react-native

try version 3 instead of version 4: npm install -d -g react-devtools@3.x, it's worked for me.

0

The answer by @Unemployed3494 didn't work for me. Instead I killed all running processes belonging to my Mac OS user with this command:

pkill -u username

After doing so, react devtools connected as expected to the simulator.

0

If connecting to the emulator proves troublesome (especially Android 12), try running adb reverse tcp:8097 tcp:8097 in a new terminal.

Rajendra
  • 15
  • 3