60

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?

Narek Malkhasyan
  • 1,332
  • 1
  • 12
  • 22

20 Answers20

52

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

npx react-native run-android
Ashad Nasim
  • 2,511
  • 21
  • 37
41

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.

Kenny83
  • 769
  • 12
  • 38
B. Kwok
  • 853
  • 2
  • 9
  • 13
15

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.

Rayon Nunes
  • 687
  • 1
  • 8
  • 15
11

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'.
TheJediCowboy
  • 8,924
  • 28
  • 136
  • 208
6

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.

  1. Open Android Studio
  2. Open Logcat
  3. Click on "Edit Filter Configuration" in the right top of the logcat screen
  4. Fill in your criteria (don't forget package name)
  5. Run you react native project on an android device or emulator

enter image description here

M_droid
  • 2,447
  • 2
  • 25
  • 35
4

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

michael_vons
  • 875
  • 1
  • 8
  • 16
3

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.

Zhang Buzz
  • 10,420
  • 6
  • 38
  • 47
2

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/
sj_959
  • 175
  • 5
  • 12
1

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.

Rohit Kaushal
  • 378
  • 3
  • 12
1

Deleting my node_modules, reinstalling them and run

npx react-native run-android

fixed it for me

Azeez Lukman
  • 81
  • 1
  • 8
0

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.

ANSHU GOYAL
  • 29
  • 1
  • 5
  • Android Device Monitor was deprecated in Android Studio 3.1 and removed from Android Studio 3.2. The features that you could use through the Android Device Monitor have been replaced by new features. – FabricioG Feb 04 '20 at 20:49
0

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

GIRIRAJ NAGAR
  • 181
  • 1
  • 5
0

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.

0

Was having this issue on Windows 10

What fixed it for me in the end was:

  1. delete C:\Users\%userprofile%\.gradle\caches
  2. deleteyour-react-app/android folder completely - then 'Discard Changes' in git so you get the original files back
  3. re-run npx react-native start and npx react-native run-android
wal
  • 17,409
  • 8
  • 74
  • 109
0

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.

feyzullahyildiz
  • 456
  • 4
  • 11
0

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

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 18 '22 at 01:03
0

For me the issue was a lot. I was using react-native-video then at some point installed react-native-track-player. These packages were supposed to run together on the app. And so it was working fine until I ran into an issue and I needed to clear my build folder.

After clearing it, my app refused to open but was installing.

What I did to fix the issue:

  • Clear my node_modules and reinstalled (This did not fix the issue)
  • Then I uninstalled react-native-track-player and started using react-native-sound-player.
  • Reinstalled react-native-video and followed the installation guide from here
  • Cleared my build again and performed all necessary npm installs

In my case, I found that using react-native-video and react-native-track-player together was the major source of my problem and I think it's related to both packages using different versions of exoplayer. So I would say you uninstall one of them or find a way to work around the exoplayer versions.

Just incase, I was using react-native-video version 5.2.1 and react-native-track-player version 3.2.0

Izutechs
  • 1
  • 1
-1

a very simple solution for me. delete this file -> gradle-wrapper.properties and run android folder with android studio.

-1

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

-1

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
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 13 '22 at 06:59