1

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>
  • Having same issue – Max Phillips Oct 08 '19 at 20:17
  • @PhilAndrews in your settings.gradle under android add the automatically generated import when you did the link from terminal under ` 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 ` libz.tbd and libBugsnagReactNative.a ` inside your mainapplication.java add the line below under the packages object ` new MainReactPackage(), BugsnagReactNative.getPackage() ` That should do it –  Oct 10 '19 at 18:31

3 Answers3

0

From Bugsnag Basic Configuration, you are missing the following:

Import and initialize Bugsnag within your app’s entry point, typically index.js (or index.ios.js and index.android.js):

import { Client } from 'bugsnag-react-native';
const bugsnag = new Client('YOUR-API-KEY-HERE');

You don't need to have the key value in the info.plist file unless you are loading the value from there (which I think you are not)

fhomovc
  • 301
  • 3
  • 15
0

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

0

In your MainApplication.java, you may need to add the following to the top section of the file:

import com.bugsnag.BugsnagReactNative;
Sators
  • 2,746
  • 1
  • 20
  • 26