Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Crashlytics for my React Native Android App?

I am trying to figure out how to use Crashlytics from Fabric for my React Native Android APP. I followed the steps on the Fabric homepage and added some lines in my build.gradle files. But the builds always crash.

Is there a difference using Crashlytics for React Native Android and Crashlytics for Native Android development using Android Studio and Java?

like image 522
BigPun86 Avatar asked Nov 03 '15 14:11

BigPun86


1 Answers

For the newer versions of React Native you have to import Bundle and place your own onCreate Method like this:

// Added Bundle to use onCreate which is needed for our Fabrics workaround
import android.os.Bundle;

..........

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Fabrics
    Fabric.with(this, new Crashlytics());

}

Not sure if this is good or not since they have removed the onCreate but it works for me

like image 123
BigPun86 Avatar answered Nov 16 '22 12:11

BigPun86