Skip to content

Step 4: Configuring the Android project (if needed)

Ioannis Kokkinidis edited this page Oct 20, 2016 · 7 revisions
  1. Go to your settings.gradle and add the following lines after

    //somewhere after include ':app' add the following 2 lines
    
    include ':react-native-bugsnag'
    project(':react-native-bugsnag').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bugsnag/android')
  2. Go to your app/build.gradle and add the following line in the end:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:23.0.1'
        compile 'com.facebook.react:react-native:+'
        //...whatever code
    
        compile project(':react-native-bugsnag')	//<--Add this line
    }
  3. Go to your AndroidManifest.xml and add the following line within the application tag replacing YOUR_API_KEY:

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

Example: here

  1. Go to your MainApplication.java and add the following code:

    import com.pintersudoplz.rnbugsnag.RNBugsnagPackage;
    

    and then within your getPackages check to see if the line with the comment is there. If not add it.

    @Override
    protected List<ReactPackage> getPackages() {
        // ...whatever code
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),            
            new RNBugsnagPackage()  //add this line
        );
    }