'Error: Exception in HostFunction: java.lang.IllegalStateException: Failed to initialise the native Bugsnag Android client

Error: Exception in HostFunction: java.lang.IllegalStateException: Failed to initialise the native Bugsnag Android client, please check you have added Bugsnag.start() in the onCreate() method of your Application subclass



Solution 1:[1]

I got this error while upgrading my React Native version from 0.66 to 0.68.2.

Referring the docs from Bugsnag community:

  1. Add the following import in your MainApplication.java class inside android folder of your project -

import com.bugsnag.android.Bugsnag;

  1. Add Bugsnag.start(this); inside your onCreate Method as below:
public class MainApplication extends Application implements ReactApplication {

        @Override

        public void onCreate() {

            super.onCreate();

            Bugsnag.start(this);

            // ...
        }
    }

I got this error resolved using the above code, let me know if this helps you too.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mehdi Rahimi