38

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
  • 45,398
  • 8
  • 30
  • 47
Eme Hado
  • 390
  • 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

9 Answers9

92

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
  • 7,009
  • 4
  • 25
  • 38
Sachin Poreyana
  • 1,947
  • 15
  • 12
21

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
  • 320
  • 2
  • 6
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,890
  • 20
  • 28
  • 35
rcnespoli
  • 643
  • 1
  • 6
  • 11
4

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
  • 41
  • 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,727
  • 1
  • 26
  • 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
1

In my case(Manjaro OS) First:

npm start

Then in a separate terminal:

npm run android
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.

Ali H. Kudeir
  • 756
  • 2
  • 9
  • 19
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.

0

Having same issue due to react-native reanimated package step 1: Go to visual studio, open terminal cmd/powershell step 2: npm uninstall react-native-reanimated step 3: cd android step 4: ./gradlew clean step 5: Hit enter and boom

Usama Saud
  • 31
  • 3