DEV Community

Kay Gosho
Kay Gosho

Posted on • Updated on

Install react-native-sentry without react-native link

Sentry has a complete manual integration guide. It might be waste of time for you to read this article!

[Added again]
Now we can use fully integrated Sentry SDK for React Native:
[/Added again]

Sentry is a great tool to collect runtime errors.

react-native-sentry is an official package by Sentry. While it is still in Beta, works well.

Official document uses react-native link, but I don't use it as it causes errors very often.

yarn add react-native-sentry


open node_modules/react-native-sentry/ios/

Then, manually drug and drop RNSentry.xcodeproj to Xcode Library. This pattern is commonly used to install native modules to React Native apps.

See my picture here:

Then, add libRNSentry.a to Build phases > Link Binary With Libraries. Note that you must not add neither libRNSentryStatic.a nor Sentry.framework which causes build errors.


Open android/settings.gradle and add the following lines:

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

Then, open android/app/build.gradle and add the following lines:

dependencies {
    compile project(':react-native-sentry')
    // other code here

Finally, open android/app/src/main/java/com/nupp1/ and add the package:



import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;

import io.sentry.RNSentryPackage;  // <-- Add this line

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;

    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new RNSentryPackage()        // <-- Add this line

    protected String getJSMainModuleName() {
      return "index";

  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;

  public void onCreate() {
    SoLoader.init(this, /* native exopackage */ false);

I hope this helps you.

Top comments (0)