Not able to run React-native app on android - node.js

I have everything installed,but when i use "npm-start" or "react-native run-android",it gets stuck at Loading "Dependency Graph ,done",nothing happens after that,any inputs would be helpful,running on Windows 10.

Make sure you have a device connected (either emulator or physical device) by running adb devices
I usually have two command line windows open. In one window I run react-native start and in the other I run react-native run-android.
Essentially, react-native start runs a packager for your app while react-native run-android will install the app on the device. If you only run react-native run-android, a new packager should start in a new cmd window.
The packager (react-native start) is where you will see Loading dependency graph... Done.

Related

Problem processing route in Ember.js app when building and running app in Android studio emulator

Trying to build and run an Ember app with Capacitor on virtual device in Android studio. Build and installation goes fine until the app is launched and stops when trying to process a spesific route. The problem only occurs when building from windows, no problem on Mac. The app is communicating with a jsonapi.
Error message in chrome device inspector: "Error while processing route [routename]"
I have tried with physical device connected getting the same message. Also tried with Genymotion plugin.
Capture of browser console:
chrome console error
And this is what logcat is giving:
logcat error
I also have some errors reported from the IDE (Android Studio) not related to running the Emulator but occurs when opening the IDE:
Android Studio errors. In case this has something to do with it.
Solution in this case:
Had to reinstall node js with another older version. Did an npm cache clean and built the app all over again. Also made sure to open the project with npx cap open android.

React Native: Failed to install the app. Could not find or load main class org.gradle.wrapper.GradleWrapperMain

I recently started my React Native journey and hit a snag before I could even start to code. I followed the guide by Facebook on how to set up your environment for a React Native project, though I installed java SDK, python and node manually instead of through chocolatey. Installing the react native application on my system went smoothly but when I try to run on my Android Emulator by using the command react-native run-android, I run into the following Error message.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
The system cannot find the path specified.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
The system cannot find the path specified.
Note: I have not made any changed in any file nor deleted anything
Steps to reproduce
Run the command react-native init AwesomeProject
cd AwesomeProject
Ensure Emulator is running then start Metro Bundler with react-native start
Run command react-native run-android in a separate terminal to receive error
Steps taken to resolve
I have tried following multiple issues and queries of others with similar problems to no avail
I tried re-installing everything from scratch to no avail, and creating a new project but the same message appears after hours of re-installation
One person suggested running gradle wrapper inside the project folder, but that too made no difference
Another suggested that a file name gradle-wapper.jar would be missing, but its there in the project folder
I tried loading the Android folder of the react native project in my Android Studio, the gradle starts building but there is still no success when the gradle is built
Packages Installed
Node V12.18.2
Java SDK V8
Python 2.7
Android Studio SDK [Android 10.0 (Q)]
Android SDK Build-Tools (Installed)
Android Emulator (Installed)
Android SDK Platform-Tools (Installed)
Intel x86 Emulator Accelerator (HAXM Installer) (Installed)
Please let me know if any further information is required to understand my problem. Thanks!

How to see changes in react native code with Android studio

am new to React Native. I have react native app (android). I run my app with Android studio and that is all working well. When I made some changes in let's say components, that changes are not reflecting in Android. I try to run react-native run-android but that not working?
Also I try this: react-native start --reset-cache
Can somebody help me with this? How can I apply code changes to the android version of my app?
It is probably because you metro server is not running. Before doing react-native run-android try to run npm start
Did you apply real-time Refresh?
Enable Hot Reloading In React Native
Follow the below steps to enable Hot Reloading Feature :
First launch your app on the device or emulator.
Command To Run React Native App :
react-native run-android
Then click on emulator and press CTRL + M (CMD + M on MacOS) or shake the Android device which has the running app.
Then select the Enable Hot Reloading option from the popup.
Enable Hot Reloading In React Native

react-native run-android and react-native start

Do I have to run react-native run-android and react-native start in my command prompt every time time I reopen my project and emulator?
-- Thanks
You usually do. The react-native run-android command might be optional if you do not want to deploy the android native code again (for instance, if you have not made any changes). You will have to launch the application manually and it will try to connect to the packager that starts with react-native start. I am not sure if you can bundle the JS for offline use in debug mode. Maybe you can try the same procedure as in this answer, but with assembleDebug in order to avoid that one.

Android Studio can not run or debug app on emulator

I have a very odd situation here:
I just want to run and debug my app on the emulator.
I get
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.myapp"
pkg: /data/local/tmp/com.example.myapp
Success
The app is correctly installed on the emulator, but does not start up.
I can run and debug this app on USB-Device.
I can run and debug any other app on same emulator.
I tried different AVDs (arm and intel), SDK and Target
Build finishes with 0 errors and 0 warnings. Eventlog is empty. I cleaned the gradle file and changed the only dependency com.android.support:appcompat-v7:21.+.
I can start the app normally on the AVD by clicking on it's icon.
When I start debugging, app installs, then waits endlessly on:
Waiting for process: com.example.myapp
I do not even now where to start looking (of course I tried rebuilding, synchronizing and cleaning cache). I also tried changing the project name.
Maybe try making a new project and copying your code over?

Resources