Native Initialization

By default, the React Native SDK initializes the native SDK underneath the init method called on the JS layer. As a result, the SDK has a current limitation of not capturing native crashes that occur prior to the init method being called on the JS layer. You can initialize the native SDKs yourself to overcome this limitation or if you want to provide custom options above what the React Native SDK currently provides.

To do this, set autoInitializeNativeSdk to false in the init options:

Copied
Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  autoInitializeNativeSdk: false,
});

This will prevent the React Native SDK from initializing the native SDK automatically.

Next, initialize the native SDKs for Android, which is documented below, or for iOS by following the configuration guide to initialize the Sentry Cocoa SDK. Note that you do not need to install the native SDKs as they are already packaged with the React Native SDK.

Android Configuration

To use auto-init, add the following to your AndroidManifest.xml:

Copied
<meta-data android:name="io.sentry.auto-init" tools:replace="android:value" android:value="true" />

Then follow the guide on initializing Android.

If you want to manually initialize the Android SDK without using the content provider, you can then follow the manual initialization guide without needing to add the tag since io.sentry.auto-init is set to false by the React Native SDK.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").