diff --git a/src/platforms/common/configuration/options.mdx b/src/platforms/common/configuration/options.mdx index 006e4b6c4ce46..3014b56e7525a 100644 --- a/src/platforms/common/configuration/options.mdx +++ b/src/platforms/common/configuration/options.mdx @@ -571,25 +571,37 @@ An optional property that configures which downstream services receive the `sent - + ## Hybrid SDK Options - + Set this boolean to `false` to disable the native SDK. This will disable all native crash and error handling and, instead, the SDK will only capture errors on the upper layer. - + + +Set this boolean to `false` to disable the auto initialization of the native layer SDK. Doing so means you will need to initialize the native SDK manually. Do not use this to disable the native layer. + + -Set this boolean to `false` to disable the auto initialization of the native layer SDK. Doing so means you will need to initialize the native SDK manually. Do not use this to disable the native layer, but instead use [enableNative](#enableNative). +To disable the native layer, use [enableNative](#enableNative). You should follow the [guide to native initialization](/platforms/react-native/manual-setup/native-init/) if you chose to use this option. + + + + +You should follow the [guide to native initialization](/platforms/flutter/native-init/) if you chose to use this option. + + + - + Set this boolean to `false` to disable hard crash handling from the native layer. Doing so means that the SDK won't capture events for hard crashes on Android and iOS if the error was caused by native code. @@ -622,7 +634,6 @@ Set this boolean to `false` to disable the scope sync from Java to NDK on Androi Set this boolean to `true` to automatically attach all threads to all logged events on Android. - @@ -631,7 +642,7 @@ Set this boolean to `false` to disable auto [performance monitoring](/product/pe - + Set this boolean to `false` to disable [out of memory](/platforms/apple/guides/ios/configuration/out-of-memory/) tracking on iOS. diff --git a/src/platforms/flutter/native-init.mdx b/src/platforms/flutter/native-init.mdx new file mode 100644 index 0000000000000..cd3be85e98d8d --- /dev/null +++ b/src/platforms/flutter/native-init.mdx @@ -0,0 +1,27 @@ +--- +title: Native Initialization +sidebar_order: 900 +description: "Learn how to manually initialize the native SDKs." +--- + +By default, the Flutter SDK initializes the native SDK underneath the `init` method called on the Flutter layer. As a result, the SDK currenty has a limitation of not capturing native crashes that occur prior to the `init` method being called on the Flutter layer. You can initialize the native SDKs yourself to overcome this limitation or if you want to provide custom options above what the Flutter SDK currently provides. + +To do this, set [autoInitializeNativeSdk](/platforms/flutter/configuration/options/#autoInitializeNativeSdk) to `false` in the init options: + +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + +Future main() async { + await SentryFlutter.init( + (options) => options + ..dsn = '___PUBLIC_DSN___' + ..autoInitializeNativeSdk = false, + appRunner: () => runApp(MyApp()), + ); +} +``` + +This will prevent the Flutter SDK from initializing the native SDKs automatically. + +Next, initialize the [Android](/platforms/android/configuration/manual-init/) and [iOS (using the configuration guide to initialize the Sentry Cocoa SDK)](/platforms/apple/guides/ios/#configure) native SDKs. Note that you do not need to install the native SDKs as they are already packaged with the Flutter SDK.