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

后端 未结 3 518
情深已故
情深已故 2021-02-04 07:23

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

3条回答
  •  后悔当初
    2021-02-04 08:21

    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

提交回复
热议问题