For the complete documentation index, see llms.txt. This page is also available as Markdown.

Reporting Crashes

Switch crash reporting on in your KMP app and report caught exceptions as non-fatals with a severity, user attributes, and an optional grouping key.

Enable or disable crash reporting

Use FeatureState to turn crash reporting on or off. Reporting only runs when the state is enabled and the user has consented (if you use consent).

Kotlin
CrashReportingKmp.setState(FeatureState.Enabled)
CrashReportingKmp.setState(FeatureState.Disabled)

Report non-fatal exceptions

Report caught exceptions so they appear in the dashboard with severity and optional grouping:

Kotlin
try {
    riskyOperation()
} catch (e: Exception) {
    CrashReportingKmp.reportException(
        exception = e,
        userAttributes = mapOf("screen" to "Checkout", "userId" to "123"),
        fingerprint = "payment_failed",  // optional, for grouping
        level = NonFatalLevel.Error
    )
    throw e
}

Parameters:

  • exception: The Throwable to report.

  • userAttributes: Key-value context (e.g. screen, user id) attached to the report.

  • fingerprint: Optional custom grouping key for similar issues.

  • level: NonFatalLevel.Critical, Error, Warning, or Info.

User attributes for crash reports

Set attributes that are attached to all subsequent crash reports:

For GDPR and privacy, you can gate sending crash reports on user consent:

When consent is false, crash reports are not sent even if crash reporting is enabled.

Callbacks

Before sending a report – add or collect extra context at report time:

Before/after non-fatal report – observe or modify non-fatal reporting:

Android-only: NDK and ANR

NDK crashes (native C/C++ crashes):

ANR (Application Not Responding):

Both are no-ops on iOS.

Crash-time handler (iOS only)

On iOS you can set a handler that runs at crash time to add attributes. It runs in a signal handler, so it must be very fast and avoid allocations and I/O:

This is a no-op on Android.

Last updated