Issue
I am trying to run a simple starter app in the android-emulator and all it shows is the following:
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?
Solution
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
Answered By - Suhail Gupta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.