Reputation: 1442
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
Reputation: 198
Well, I solved this error using the following steps:
Happy Coding!
Upvotes: 0
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
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:
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
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
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
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
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
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
Reputation: 2513
my bug was fixed by deleting the build folder(inside android/app) and running
npx react-native run-android
Upvotes: 56
Reputation: 91
Deleting my node_modules
, reinstalling them and run
npx react-native run-android
fixed it for me
Upvotes: 1
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
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
Reputation: 17719
Was having this issue on Windows 10
What fixed it for me in the end was:
C:\Users\%userprofile%\.gradle\caches
your-react-app/android
folder completely - then 'Discard Changes' in git so you get the original files backnpx react-native start
and npx react-native run-android
Upvotes: 0
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
Reputation: 1
a very simple solution for me. delete this file -> gradle-wrapper.properties and run android folder with android studio.
Upvotes: -1
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
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
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
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.
Upvotes: 7
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
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
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