70

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?

2
  • 3
    Can you check on ios device? Commented Mar 18, 2018 at 20:15
  • can you please share the code where you are getting this issue? Commented Jan 17, 2022 at 9:00

22 Answers 22

57

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

npx react-native run-android
Sign up to request clarification or add additional context in comments.

8 Comments

This is what worked for me... I have the command "yarn android" to build, but had to delete android/app/build.
Worked for me too, I got crashes after installing an npm package, but this method fixed that
deleting build folder gave me out of memory error Now fixing that error
@ZeeshanAhmadKhalil Run ./gradlew clean in the android folder
can you explain more . where is the android/app located
|
46

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.

5 Comments

Thnx i was able to find about, why android app was crashing
I am fased issue with your command. 'grep' is not recognized as an internal or external command,
@BaiMaoli "grep" is a Linux command. The equivalent would be "findstr" in windows.
to see the logs when using zsh use adb logcat '*:S' ReactNative:V ReactNativeJS:V
To see the logs using zsh, you can also use noglob adb logcat *:S ReactNative:V ReactNativeJS:V as mentioned in the article
16

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'.

1 Comment

Knowing what is happening is essential in debugging and this helped me to understand what is happening. Thank you
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.

1 Comment

but i am using VS code should it will work in VS code also.
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

Comments

5

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

Comments

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.

Comments

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/

Comments

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.

Comments

1

Deleting my node_modules, reinstalling them and run

npx react-native run-android

fixed it for me

Comments

1

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.

Comments

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.

1 Comment

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.
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

Comments

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.

Comments

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

Comments

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

Comments

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..

Comments

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!

Comments

-1

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

Comments

-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

Comments

-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

1 Comment

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.
-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

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.