When the UI thread of an Android app takes too long, an Application Not Responding (ANR) message is shown to the user. This causes the screen to lock up and prevents the user from being able to make any actions in the app. Although not technically a crash, it sure is just as frustrating as one.
Bugsnag helps you understand the cause of these ANRs by providing actionable information including stack trace, breadcrumbs, and device analytics. Whether your Android app is native or written in a cross-platform app such as React Native or Unity, Bugsnag’s notifiers automatically capture these messages for you to investigate and fix.
Bugsnag shows you the line of code that was running when the app received an ANR message. This gives you an idea of the likely culprit that is causing the app to hang. The relationship between the error report and the root cause is often less clear for ANRs than it is for crashes. This makes seeing the stack trace and surrounding code especially useful to identify clues that may lead to common ANR causes such as memory leaks, threading issues, and background app management. All ANRs that were running the same line of code get grouped together so you can see the broader impact of the ANR on your users.
Bugsnag automatically captures breadcrumbs to allow you to see the user actions that were being taken when the ANR was detected. Since the root cause of ANRs isn’t always clear, breadcrumbs are a good indicator to patterns in user behaviour that occur in the run up to an ANR. User interaction breadcrumbs, such as device rotation and navigation, are often related to ANRs and having them automatically captured makes it easier to draw the connection between certain user actions and the ANRs that are being seen.
Any Android engineer understands the challenges of designing apps for the vast landscape of Android devices out in the wild. A single Android app can expect to see users on thousands of devices, which makes testing and error monitoring incredibly unruly. This is especially true for ANRs, as the wide array of Android devices available on the market means that some models are prone to have outdated or underpowered hardware. Bugsnag allows you to filter and view pivot tables based on device model to help distill the problem to the most commonly affected devices so that you can investigate and prioritize (or deprioritize) issues.
We recently released an enhancement to device analytics to include a friendlier model name. Rather than seeing SM-G960U and opening a new tab to ask Google what device this is, Bugsnag has done the legwork to map codes to model names, so you can search for Galaxy S9 directly into the filter bar or see it directly in the pivot tables.
With all this automatically captured data and diagnostics, Bugsnag hopes to make fixing ANRs a smoother developer experience on Android, React Native and Unity apps. Update to the latest version of the notifier, and then rest assured that every ANR is being captured.