Narek Malkhasyan
Narek Malkhasyan

Reputation: 1442

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?

Upvotes: 68

Views: 114125

Answers (22)

Mian Aamir Shehzad
Mian Aamir Shehzad

Reputation: 198

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!

Upvotes: 0

Asadullah abbasi
Asadullah abbasi

Reputation: 1

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

Upvotes: 0

Izutechs
Izutechs

Reputation: 11

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

Upvotes: 0

Sameer Shoukat
Sameer Shoukat

Reputation: 17

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

Upvotes: -3

Muhammad Umer Baig
Muhammad Umer Baig

Reputation: 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

Upvotes: -1

feyzullahyildiz
feyzullahyildiz

Reputation: 667

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.

Upvotes: 0

Moses Gameli
Moses Gameli

Reputation: 61

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

Upvotes: -1

TheJediCowboy
TheJediCowboy

Reputation: 9222

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

Upvotes: 16

Ashad
Ashad

Reputation: 2513

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

npx react-native run-android

Upvotes: 56

Azeez Lukman
Azeez Lukman

Reputation: 91

Deleting my node_modules, reinstalling them and run

npx react-native run-android

fixed it for me

Upvotes: 1

B. Kwok
B. Kwok

Reputation: 903

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.

Upvotes: 46

Rohit Kaushal
Rohit Kaushal

Reputation: 558

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.

Upvotes: 1

wal
wal

Reputation: 17719

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

Upvotes: 0

sj_959
sj_959

Reputation: 431

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/

Upvotes: 2

Imran Neaxus
Imran Neaxus

Reputation: 1

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

Upvotes: -1

Rayon Nunes
Rayon Nunes

Reputation: 767

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.

Upvotes: 15

michael_vons
michael_vons

Reputation: 1060

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

Upvotes: 5

Zhang Buzz
Zhang Buzz

Reputation: 11028

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.

Upvotes: 3

M_droid
M_droid

Reputation: 2768

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

Upvotes: 7

Joao Lucas Teta
Joao Lucas Teta

Reputation: 16

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.

Upvotes: 0

GIRIRAJ NAGAR
GIRIRAJ NAGAR

Reputation: 201

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

Upvotes: 0

ANSHU GOYAL
ANSHU GOYAL

Reputation: 29

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.

Upvotes: 0

Related Questions