Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 277
Narek Malkhasyan Avatar asked Mar 18 '18 19:03

Narek Malkhasyan


People also ask

How do I know if an app crashes in react native?

How do I know if an app crashes in react native? Connect your device to your computer. Run adb devices to check out if your device is detected. Now run adb logcat : This command will output all logs (debug and error levels) coming from your Android Device.

Which tool you use to track crashes in react native apps?

Crashlytics helps you to collect analytics and details about crashes and errors that occur in your app. It does this through three aspects: Logs: Log events in your app to be sent with the crash report for context if your app crashes.

How do I see console log in react native?

Note that as of React Native 0.29 and later, you can get logs without running the debugger. Just run react-native log-ios or react-native log-android on the command line inside your project folder. And when you open the Remote JS Debugging, you have to press option+command+i and check the console.


2 Answers

my bug was fixed by deleting the build folder(inside android/app) and running

npx react-native run-android 
like image 145
Ashad Nasim Avatar answered Sep 19 '22 23:09

Ashad Nasim


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.

like image 23
B. Kwok Avatar answered Sep 18 '22 23:09

B. Kwok