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.
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}}}
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}}}
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}}}
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>"))}