1

I am a newbie in react-native.I followed the official documentation of react-native to install it on linux-ubuntu. I followed all the steps.Everthing is running fine except of this problem. react-native run-android command is running successfully , but got stuck with a white background with green strip on the top . The green color strip on the top of emulator is written as " loding from 10.0.2.2.8081" I am stuck on this problem ,everthing else is running fine ,but the android simulator is stuck on it

These are my logs on terminal after running react-native run-android

info Starting JS server...
info Building and installing the app on the device (cd android && 
./gradlew app:installDebug)...
10:57:00 V/ddms: execute: running am get-config
10:57:00 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
10:57:00 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel_XL_API_28(AVD) - 9' for app:debug
10:57:00 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'
10:57:00 D/Device: Uploading file onto device 'emulator-5554'
10:57:00 D/ddms: Reading file permision of /home/babita/AwesomeProject/android/app/build/outputs/apk/debug/app-debug.apk as: rw-rw-r--
10:57:00 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
10:57:01 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
10:57:01 V/ddms: execute: returning
10:57:01 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
10:57:01 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
10:57:01 V/ddms: execute: returning
Installed on 1 device.

BUILD SUCCESSFUL in 3s
26 actionable tasks: 1 executed, 25 up-to-date
info Running /home/babita/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
info Starting the app on emulator-5554 (/home/babita/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.awesomeproject/com.awesomeproject.MainActivity)...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }
Boken
  • 4,825
  • 10
  • 32
  • 42
Babita Bisht
  • 385
  • 1
  • 4
  • 18

3 Answers3

2

After a long discussion with you, I have finally figured out what the problem. The problem is that you are getting the error

unable to load script from assets index.android.bundle

and you simply dismiss that error while nothing has been loading for the app from the bundle to display. So that is why you are getting a white screen every time.

Follow these steps in Terminal (since you are using Linux). Windows users follow these steps in CMD

1) Go to your project root directory in Terminal(or CMD)

2) Run this command mkdir android\app\src\main\assets

3) After this command run this command react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res 4) then run react-native run-android command

Optional steps

After step 3 you can follow these steps too:

3.1) cd android

3.2) gradlew clean

3.3) cd..

3.4) react-native run-android

HarshitMadhav
  • 4,769
  • 6
  • 36
  • 45
  • I can't thank you enough, thank you so much for investing so much time in this problem. I spend my whole day solving this problem, finally got the solution from you. Again thank you very much – Babita Bisht Mar 31 '19 at 16:34
  • You're welcome. Cheers!! Happy Learning React Native!! – HarshitMadhav Mar 31 '19 at 16:48
0

Try the following:

  • Bring up the react-native developer menu (something that looks like the first image below). I assume that you know how to do that.
  • Click on dev settings, then click on 'Debug server host & port for device' - see second image below) and type localhost:8081
  • Try to reload. If it doesn't work, terminate the app and start it again
  • If it didn't work try to type the following instead: localhost:8081/debugger-ui

dev settings

Debug server host & port for device

Yossi
  • 5,577
  • 7
  • 41
  • 76
0

I had a clean build but still it was stuck at LOADING screen. I restarted my machine and it worked.

gorp88
  • 105
  • 14