31

I have initiated successfully a new react-native project. Then, every time I try to run my newly built project using the command react-native run-android, it gets stucks on info Starting JS server....

Here is the output:

$ react-native run-android
info Running jetifier to migrate libraries to AndroidX".
 You can disable it using "--no-jetifier" flag.
Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
info Starting JS server..."

I tried restarting the laptop and switching emulators. I don't know what else to do anymore.

How do I solve the problem?

nbk
  • 31,930
  • 6
  • 24
  • 40
Eme Hado
  • 320
  • 1
  • 4
  • 9
  • 1
    i found a way around it, i had to close the auto server that opens to allow the react-native cli to skip awaiting the launch of the js server and then i started it manually – Eme Hado Aug 01 '19 at 17:02
  • I have same issue. I found that `npm run android` will stuck on VS Code terminal, but its normal on system terminal (I'm using GNOME terminal). – Muhammad Irvan Hermawan Mar 16 '22 at 02:11

7 Answers7

82

Kill the automatically popped up metro bundler command prompt

Kill the command terminal which is running react-native run-android

Now Run react-native start This will start your js server

In new command prompt window run react-native run-android The app came up in 5 mins in an emulator.

Ramesh R
  • 6,683
  • 3
  • 22
  • 34
Sachin Poreyana
  • 1,757
  • 13
  • 11
15

Linux: Go to the terminal and type: react-native start

and then in OTHER terminal, inside your project folder: yarn android or npm run android

Breno Mazieiro
  • 161
  • 1
  • 5
5

Temporary fix:

REACT_TERMINAL= react-native run-android

in my case with manjaro + xfce4:

REACT_TERMINAL=xfce4-terminal react-native run-android

or puts in your .bashrc:

export REACT_TERMINAL=xfce4-terminal

font: https://github.com/facebook/react-native/issues/26097

Simas Joneliunas
  • 2,705
  • 15
  • 25
  • 32
rcnespoli
  • 503
  • 5
  • 9
3

I had the same problem. I started a project yesterday and it worked, started a new one today and it didn't work. The problem seems to be "@react-native-community/cli-platform-android". The version that showed up today is 2.8.2 as opposed to 2.7.0 for yesterday's project.

I used: npm install @react-native-community/cli-platform-android@2.7.0

This is not a optimal solution, but it will get you going.

pawkw
  • 31
  • 2
2

I had the exact same frustrating issue for a very different reason than mentioned in other answers.

As explained in this SO answer Android adb binds to port 5037 and I installed some program which took this port so adb was hanging silently (why adb! .. say something!)

Commands to test if this your issue cause:

test any adb command and see if it hangs, eg:

adb devices

If it does, then check who is using the port:

sudo lsof -i :5037
Nimir
  • 5,589
  • 1
  • 24
  • 34
  • 2
    Saved my day. My emulator (not sure why) process was running and was not even showing on the screen. After killing the process, react-native worked smoothly. Thanks, man! – Swr7der Apr 14 '20 at 15:35
0

The best solution that I constantly find myself using, is going to the application manager on android, then clearing the data of the app. Running the app afterwards goes smoothly without lagging.

decoder
  • 486
  • 1
  • 6
  • 16
0

Reinstalling android studio with a new emulator or changing the app name in app.json , build.gradle and android manifest.xml solved the issue.