Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - Build successful on android but app crash

When I build (> react-native run-android) with my dependencies the build is successful ! However, when the app is launch it crash immediately ... How don't know how is it possible, there is no error, nothing to tell me why the application is crashing...

It's sure it is from the dependencies...

dependencies {
    implementation project(':react-native-intercom')
    implementation "io.intercom.android:intercom-sdk:3.+"

    implementation project(':react-native-onesignal')
    implementation 'com.google.android.gms:play-services-location:+'

    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-i18n')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"
    implementation project(':tipsi-stripe')
    implementation (project(':react-native-maps')) {
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation (project(':react-native-camera')) {
        exclude group: "com.google.android.gms"
        exclude group: "com.android.support", module: 'support-v4'
    }
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation 'com.google.android.gms:play-services-base:10.0.1'
    implementation 'com.google.android.gms:play-services-maps:10.0.1'
    implementation 'com.google.android.gms:play-services-gcm:10.0.1'
}

Thank you really much

like image 361
eQuinox Avatar asked May 10 '18 09:05

eQuinox


People also ask

How do I stop my react native app from crashing?

A react native module that lets you to register a global error handler that can capture fatal/non fatal uncaught exceptions. The module helps prevent abrupt crashing of RN Apps without a graceful message to the user. In the current scenario: In DEV mode , you get a RED Screen error pointing your errors.

Why does my app keep crashing on Android?

If your Android apps keep crashing or freezing it's usually because you're low on space or running too many apps at once. Other reasons for crashing apps include a spotty Wi-Fi connection or an old version of the app that hasn't been updated.

Why does my Android app keeps crashing Android studio?

An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java or Kotlin crashes if it throws an unhandled exception, represented by the Throwable class.

Why are my Apps crashing for no reason?

This usually occurs when your Wi-Fi or cellular data is slow or unstable, causing apps to malfunction. Another reason for Android apps crashing can be a lack of storage space in your device. This can occur when you overload your device's internal memory with heavy apps.


1 Answers

For checking exception logs in generated release mode apk follow steps 1-3. (Step 1 can be skipped if signed release mode apk is already installed on device.)

  1. Make sure adb devices command lists your device then Install app on device/emulator by running below command from folder with apk.

    adb -d install -r app-name.apk ex : adb -d install -r learnapp.apk

change -d to -e if you want to install on emulator.

  1. run adb logcat | FINDSTR "Exception" This will log all exception messages on cmd.

  2. Now start the app and exception detail will be available on cmd.

Exceptions can be really minute problems for example i had console.clear() in one of my app screen's componentDidMount() hook and console.clear is undefined exception was causing the crash after navigating to that screen. After running steps 1-3 I found out the exception, removed that line from code, generated apk again and app worked just fine afterwards!!

like image 99
Rajesh Sharma Avatar answered Oct 05 '22 23:10

Rajesh Sharma