Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native stuck at loading from localhost : 8081 on physical device using USB debugger

Tags:

react-native

When I run react-native run-android it builds successfully and there after Mobile screen shows nothing more than loading from local host : 8081

I have tried adb reverse tcp:8081 tcp:8081

like image 615
Harsh Vishnoi Avatar asked Oct 21 '25 15:10

Harsh Vishnoi


2 Answers

Start by closing the App on your phone and clearing phone memory.

Close metro bundler on your PC.

Then clear npm cache as follows: npm cache clean --force

Then clean up gradle as follows:

  1. Change into android directory in your project folder: cd android

  2. To clean clean gradle simply run: ./gradlew clean

cd .. back into your project's root directory.

Build your app again using whichever method suits you. My preferred method for RN apps without expo on a windows machine is as follows:

npx react-native run-android

like image 199
andromeda Avatar answered Oct 23 '25 05:10

andromeda


For some reason it was a watchman issue. I remember installing watchman a few days before and it was causing the issue. I uninstalled watchman and it worked.

like image 27
Binit Avatar answered Oct 23 '25 05:10

Binit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!