3

I am trying to run a simple starter app in the android-emulator and all it shows is the following: enter image description here

I am not sure, where am I going wrong. Here are steps I followed to reach here:

  • react-native init HelloWorld
  • Set up AVD as you see in the above picture
  • react-native run-android

That is all. Here is the output of the command react-native run-android:

Scanning folders for symlinks in /home/suhail/test/react-native/HelloWorld/node_modules (10ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

> Configure project :app 
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Task :app:installDebug 
Installing APK 'app-debug.apk' on 'Nexus_Phone(AVD) - 6.0' for app:debug
Installed on 1 device.


BUILD SUCCESSFUL in 1m 48s
28 actionable tasks: 1 executed, 27 up-to-date
Running /home/suhail/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (/home/suhail/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.helloworld/com.helloworld.MainActivity)...
Starting: Intent { cmp=com.helloworld/.MainActivity }

which does not show any error message. Is there anything then, I am missing?

Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328

2 Answers2

2

I was finally able to solve the problem using @Nguyen answer and some other steps. Here are the steps I followed:

  • On the emulator press ctrl+m (Linux) and open the developer menu.
  • Choose the debug server and port and set the value as localhost:8081
  • mkdir android/app/src/main/assets
  • 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
  • react-native run-android
  • At the other terminal I also started the server using npm start

While running the command 4, I was getting an error saying watchman-crawl-failed, which could be solved by referring to this SO post

Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
1
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
pkill node