error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds` - react-native

I've spend lots of time solving this problem but it didn't work
When I tried to run android emulator in react native by typing react-native run-android
but it didn't work beacause of this error
detail code for error that happened
so I opened react-native doctor to see the problem. cause I already have Android Studio, and the emulator was already running before I typed react-native run-android.
Finally I found my error saying this.
problem on react-native doctor
Is there anyone who can teach me to solve this problem?
I have no idea why the computer can't recognize Android Studio.
so sad..

Related

react-native-cli error when running ios emulator

After 5 days I have been able to fix the issue with initializing a react native cli project. Now I can set it up successfully.
The issue now though, is when I try to run npm run ios in order to run the ios simulator. Of course this is done in the 2nd terminal tab, the 1st tab is where I npm start to start the react native metro server.
Basically after npm run ios, my ios emulator successfully opens up by itself. However, straight after, VScode gives me a long error. I have put all the error into pastebin: https://pastebin.com/egnLA9ei
I ran npx react-native doctor and fixed the issues. Here is the screenshot
Even though it is all green ticks, the same error is still there. (Lets focus on ios for now, ignore android for now)
I feel so close to finally being able to continue my learning. If you could offer some help, please do.
Thank you for your time.

Metro Bundler does not start (MacOS)

I installed React Native following the requirements in the documentation (https://reactnative.dev/docs/environment-setup) , i got all the simulators working but i have to manually open them everytime i open the project.
If i press m after npm start the following error shows "warn No apps connected. Sending "devMenu" to all React Native apps failed."
(Btw this is my first time using React-Native so sorry if this is a rookie mistake)
Does anyone know any solution ?

React Native App Install But does not Open

I have a react native app that builds and installs successfully. However, it does not run. When I click to open it, it shows a white screen for a second then closes itself. Attached is a screenshot of the terminal when I run react-native run-android
Has anyone ever encountered this problem and how did you solve it?
Its possibly related to native side errors you can debug that by using android studio and try running the project in studio you will get the errors in log cat of android studio

react-native metro is path is missing in node_modules

Error is this
Error: Unable to resolve module metro/src/lib/bundle-modules/HMRClient
Here is additional error logs
This error appeared when I had to create a new project and ran react-native run-android just right after running react-native init PROJECT_NAME. Why I had to create another project is due to another error shown in this question.
Now I can't seem to run any of my react-native applications due to these problems. I am thinking this is a cache problem or somethings? maybe unstable package versions.
I have also found this solution in GitHub threads and actually removed the error log, but keeps crashing my application in android emulator (android studio)
I have tried reinstalling react-native-cli, but still have this error.

React Native app crashes without any error log

React Native app crashing without any error log. No output on "react-native log-android" terminal, no red screen with error, Android emulator just crashes. Tried running with Expo, again crashes with no error
Happens when working with TextInput. I have some ideas how I can fix the code, but want to understand why is app crashing without error log and making debugging much more difficult?
my bug was fixed by deleting the build folder(inside android/app) and running
npx react-native run-android
Run adb logcat
You can find your app name in your package.json, under the name field.
Also when looking for errors specifically dealing with react native, try running
adb logcat | grep 'redbox'
This way you don't have to scan the entire logfile.
Or try the method shown in this article:
Run adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your Android app's logs.
I was running an Android Project on my Linux PC, then I have made some changes on it in a MacOS PC, and when I git pulled de project back to Linux I faced that crashes
inside the android folder, just run:
./gradlew clean
and then try to run it again.
In case none of these work, don't hesitate to just filter on Warning or Higher as sometimes there will be a low level error that will not be caught by the RN filters.
I was only able to find my issue(s) with the following:
adb logcat '*:W'.
In case react native app crashes without an error message checking the problem in Android Studio's Logcat works perfect. But don't forget to create a filter with your package name.
Open Android Studio
Open Logcat
Click on "Edit Filter Configuration" in the right top of the logcat screen
Fill in your criteria (don't forget package name)
Run you react native project on an android device or emulator
This may be because SOLoader is absent.
Ensure
implementation'com.facebook.soloader:soloader:0.9.0+'
is added under dependencies in android/app/build.gradlle
clean your build
cd android
./gradlew clean
Try bundling
./gradlew bundleRelease
Exit android folder
cd ../
Try running
npx react-native run-android --variant=release
My app kept crashing because I had changed the name of the app in a few places. Make sure your app name is the same everywhere.
Check if the folder name in
android/app/src/main/java/com/<appname>
has the same name as that of your app in manifest file in
android/app/src/main/
My RN App works correctly before, suddenly one day it does not work, keeps crashing without error log. All I have to do is: delete build and .gradle folder under android folder, then run again, it works. Hope it may help someone.
this worked for me
run react-native start --reset-cache
after this if app throws some import error kill the task and run react-native start or npm start normally and open the app.
Deleting my node_modules, reinstalling them and run
npx react-native run-android
fixed it for me
While running your Android Emulator for debugging also run
Android Studio -> Tools -> Android -> Android Device Monitor
It will tell you exactly what is crashing the app under LogCat tab.
two easy steps solved my problem...
open android studio and remove offline bundle from src/main/assest..(** if any)
open MainApplication.java and remove the following import..
import com.facebook.react.BuildConfig
I had the same issue, maybe you made the same mistakes i did.
Make sure u didn't change the app's package name (ex: com.myapp.app).
I lost a lot of time on this. Seems like someone else published a app with the same name on google play, and i didnt change it correctly in each place i should on mine.
Anyway, if that is not your problem, it is probably in something u changed in build.gradle or other config file, try to remember where u last changed something.
Was having this issue on Windows 10
What fixed it for me in the end was:
delete C:\Users\%userprofile%\.gradle\caches
deleteyour-react-app/android folder completely - then 'Discard Changes' in git so you get the original files back
re-run npx react-native start and npx react-native run-android
A tip, my emulator api version was 32. And my targetSdkVersion was 31.
I created another emulator which api level is 31 and the error is gone.
Well first of all, does it crashes when it opens or does it crash at a specific screen? Mine crashed because I did not put my text inside <Text></Text> inside the TouchableOpacity
a very simple solution for me.
delete this file -> gradle-wrapper.properties
and run android folder with android studio.
In case you tried any of the given suggestions and none worked, use Android Studio to run the app in debug mode and then watch logs at the debug console.
For me, it was a styling rule error. I did
paddingTop: Platform.OS === 'ios' && 50 which caused the app to exit immediately on Android.
The debug console log I got was E/unknown:ViewManager: Error while updating prop paddingTop
To correct that, I did paddingTop: Platform.OS === 'ios' ? 150 : 0
Delete Your node modules
Then run npm install
after this run
for window
gradlew clean
for macOS
./gradlew clean
then run
npx react-natie run-android --variant-release
or
npx react-natie run-android