React Native app crashes without any error log
Asked Answered
S

22

66

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?

Standush answered 18/3, 2018 at 19:38 Comment(2)
Can you check on ios device?Suprarenal
can you please share the code where you are getting this issue?Salesin
P
55

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

npx react-native run-android
Passacaglia answered 1/4, 2020 at 7:24 Comment(8)
This is what worked for me... I have the command "yarn android" to build, but had to delete android/app/build.Perez
Worked for me too, I got crashes after installing an npm package, but this method fixed thatTurnedon
deleting build folder gave me out of memory error Now fixing that errorCorsage
@ZeeshanAhmadKhalil Run ./gradlew clean in the android folderPassacaglia
can you explain more . where is the android/app locatedAristotelianism
in the root folderPassacaglia
no answers are accepted as of nowPassacaglia
did not work for me. I am still getting this and i tried the ./gradlew clean and the build delete. Also a npm install.Decorate
B
45

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.

Balaton answered 13/4, 2018 at 20:43 Comment(4)
Thnx i was able to find about, why android app was crashingEupatorium
I am fased issue with your command. 'grep' is not recognized as an internal or external command,Hopple
@Hopple "grep" is a Linux command. The equivalent would be "findstr" in windows.Archie
to see the logs when using zsh use adb logcat '*:S' ReactNative:V ReactNativeJS:VMacro
O
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.

Oilcup answered 24/12, 2020 at 14:19 Comment(3)
This saved me. Thank you.Petaloid
Saved me too. Thank youFour
but i am using VS code should it will work in VS code also.Aristotelianism
S
14

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'.
Stigmasterol answered 17/1, 2022 at 4:36 Comment(0)
M
7

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

Moat answered 10/9, 2020 at 12:40 Comment(0)
P
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

Pralltriller answered 3/12, 2020 at 8:12 Comment(0)
B
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.

Borderline answered 23/10, 2020 at 8:22 Comment(0)
H
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/
Haemal answered 8/4, 2021 at 8:18 Comment(0)
S
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.

Scumble answered 2/7, 2021 at 13:2 Comment(0)
S
1

Deleting my node_modules, reinstalling them and run

npx react-native run-android

fixed it for me

Stockpile answered 3/11, 2021 at 11:6 Comment(0)
B
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.

Bandwidth answered 14/4, 2018 at 5:9 Comment(1)
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.Barthold
S
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

Subsequent answered 29/3, 2020 at 11:14 Comment(0)
G
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.

Gracegraceful answered 20/4, 2020 at 16:45 Comment(0)
R
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
Ron answered 20/5, 2021 at 6:23 Comment(0)
A
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.

Aggrade answered 29/5, 2022 at 23:52 Comment(0)
A
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

Abisha answered 27/3, 2023 at 19:23 Comment(0)
U
0

ahhh i ran into same error and when i commented out Textinput component build got passed it was because i was using invalid css property like font weight is not supported..

Ut answered 14/5, 2024 at 13:20 Comment(0)
P
0

Well, I solved this error using the following steps:

  • Delete node_modules from your React Native app.
  • Re-install modules using npm install command.
  • Move to the Android folder using cd android and run the ./gradlew clean command to clean for any issues left.
  • Most important: Close your VS Code program and re-open it (sometimes it causes unforeseen issues).
  • Now open Android Studio and sync changes. You can find it at top-right side menu list.
  • Then Rebuild the app. You're good to go!

Happy Coding!

Pillow answered 11/7, 2024 at 8:29 Comment(0)
F
-1

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

Ferde answered 18/3, 2021 at 10:12 Comment(0)
S
-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

Suture answered 21/3, 2022 at 11:12 Comment(0)
A
-1

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

Aversion answered 12/10, 2022 at 10:4 Comment(1)
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.Cycad
I
-3

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
Isabeau answered 8/11, 2022 at 14:8 Comment(1)
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.Cycad

© 2022 - 2025 — McMap. All rights reserved.