androidiosreact-nativebugsnag

React Native Runtime Error: No native client found. Is Bugsnag React Native installed in your native code project?


I am trying to integrate bugsnag to my react native application. The app builds successfully but when the app loads on a simulator or emulator it throws an exception

Bugsnag: No native client found. Is BugsnagReactNative installed in your native code project?
Client

<unknown>
    global.js:4:27
loadModuleImplementation
    require.js:331:6
<unknown>
    index.android.js:9
loadModuleImplementation
    require.js:331:6
guardedLoadModule
    require.js:197:45
global code

I have updated my AndroidManifest.xml, MainApplication.java, Info.plist, build.gradle to include the api-key and bugsnag-react-native was successful too.

my package.json versions look like

"react": "16.8.3",
"react-native": "0.59.10",
"bugsnag-react-native": "^2.23.2",

AndroidManifest.xml

 <meta-data android:name="com.bugsnag.android.API_KEY"
               android:value="API KEY"/>

MainApplication.java

@Override
 public void onCreate() {
    super.onCreate();
    BugsnagReactNative.start(this);
    SoLoader.init(this, /* native exopackage */ false);
  }

info.plist

<key>BugsnagAPIKey</key>
<string>API KEY</string>

Solution

  • if you did react-native link bugsnag-react-native. Then you will need following changes if you are having this issue. I found the solution.

    In you Android/settings.gradle put the include bugsnag-react-native under include ':app'

    include ':app'
    include ':bugsnag-react-native'
    project(':bugsnag-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/bugsnag-react-native/android')
    

    make sure you have binaries linked in your Xcode. To do so select your project in Xcode, click build phases, link binary with libraries and add the following libraries. To manually import bugsnag-react-native from node_modules in Xcode follow the link below

    libz.tbd and 
    libBugsnagReactNative.a
    

    In your MainApplication.java add the line in getPackages()

    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
    new MainReactPackage(), BugsnagReactNative.getPackage()
    

    That should do the work.

    Bugsnag Docs Manual linking