Error and crash reporting

  • Latest Dynatrace
  • Explanation

Monitoring crashes, ANRs and errors is critical for ensuring a seamless user experience. These issues can lead to app uninstalls, negative reviews, and loss of user trust. By proactively detecting and addressing these errors, developers can improve app stability and retain user engagement. DDynatrace provides detailed insights into these error events, including stack traces, session details, and device-specific information to quickly identify root causes and implement fixes.

Automatic Crash Reporting

OneAgent captures all uncaught exceptions. The crash report includes the occurrence time and the full stack trace of the exception.

In general, the crash details are sent immediately after the crash, so the user doesn’t have to relaunch the application. However, in some cases, the application should be reopened within 10 minutes so that the crash report is sent. Note that Dynatrace doesn't send crash reports that are older than 10 minutes (as such reports can no longer be correlated on the Dynatrace Cluster).

You can deactivate crash reporting with the crashReporting property.

dynatrace {
configurations {
sampleConfig {
crashReporting false
}
}
}

ANRs

  • OneAgent only reports ANR errors on devices with Android 11 or higher. On older Android versions, the ANR Error event is not available.
  • These events are sent only if the mobile app is restarted within a timeframe of 10 minutes by the user.

With the New RUM Experience, Dynatrace automatically captures “Application Not Responding”(ANR) errors. ANRs are critical to monitor as they cause frustration to the user. The main problem is that the app's main thread, which is responsible for updating the UI, can't process user input events or draw, forcing the app to be closed. The official Android documentation lists examples and how to diagnose them.

By default, this feature is turned on. To turn it off use the following configuration options:

Using the ConfigurationBuilder when starting the agent manually:

Dynatrace.startup(this, DynatraceConfigurationBuilder("<YourApplicationID>", "<ProvidedBeaconUrl>")
.withAnrReporting(false)
.buildConfiguration()
)

Using the gradle DSL configuration:

dynatrace {
configurations {
sampleConfig {
anrReporting false
}
}
}

Limitations

  • Multiple ANRs in one session—in rare cases, multiple ANRs may occur before the app is restarted. Dynatrace will send separate events for each ANR, even if they belong to the same session.
  • Unknown ANRs—some ANRs may lack a clear type or subject. These are still reported with available details.
  • System limitations—the Android OS determines the quality of ANR data. Missing stack traces or incomplete subjects may occur due to: overwriting of shared storage for traces, severe crashes (for example, corrupted memory), custom firmware behavior.

Native crash reporting

  • OneAgent only reports Native Crashes on devices with Android 11 or higher. On older Android versions, the Native Crash event is not available.
  • These events are sent only if the mobile app is restarted within a timeframe of 10 minutes by the user.

Native crashes are crashes that originate in C/C++ code added via NDK. The official Android documentation lists examples and how to diagnose them.

By default, this feature is turned on. To turn it off use the following configuration options:

Using the ConfigurationBuilder when starting the agent manually:

Dynatrace.startup(this, DynatraceConfigurationBuilder("<YourApplicationID>", "<ProvidedBeaconUrl>")
.withNativeCrashReporting(false)
.buildConfiguration()
)

Using the gradle DSL configuration:

dynatrace {
configurations {
sampleConfig {
nativeCrashReporting false
}
}
}

Limitations

  • Empty stack traces—in some cases, the Android system may return a null stack trace due to overwritten shared storage, severe crashes (for example, corrupted libc), and custom firmware behavior.
  • Multiple crashes in one session—if multiple native crashes occur before the app is restarted, Dynatrace will send separate events for each crash.

Manual Error Reporting

For errors that you handle in your code but still want to report to Dynatrace, use the manual reporting APIs.

Use Dynatrace.sendExceptionEvent(ExceptionEventData exceptionEventData) to report exceptions with full context and custom properties:

try {
} catch(exception: Exception) {
Dynatrace.sendExceptionEvent(
ExceptionEventData(exception)
.addEventProperty("event_properties.<YourPropertyName>", "<YourPropertyValue>")
)
}
Related tags
Digital Experience