A detailed look at how the Android OS monitors, processes, and triggers Application Not Responding (ANR) errors.
Key takeaways
- An Application Not Responding (ANR) error occurs when the Android framework determines that an app has failed to respond within a component-specific timeout. The system enforces this by tracking deadlines for specific operations (such as input dispatch or broadcast delivery). If the operation has not finished by its deadline, the corresponding watchdog logic triggers an ANR.
- ANRs are triggered differently depending on the Android component involved. BroadcastReceiver, Service, ContentProvider, and Activity components each have distinct detection logic and timeout thresholds, with Activities primarily subject to input dispatch timeouts.
- ANR reports often misidentify the true cause. Blocking work earlier on the main thread can delay input handling so the Activity is flagged even though the real issue was triggered elsewhere.
- User-perceived ANRs directly impact your app’s ranking on the Play Store. ANRs triggered by input dispatch timeouts are surfaced in Android Vitals and used to assess app quality and visibility
Application Not Responding (ANR) errors are some of the most frustrating to encounter and often difficult to debug. Worse yet, if you can’t keep your ANR rate under control, your app will be downranked and less discoverable in the Google Play Store.
While Android documentation provides guidance on ANRs, we’ve found that it only scratches the surface on exactly how these particular errors work in the wild.
To help you get a better handle on how to detect and capture ANR data, we asked our Android architect Jamie Lynch to describe in detail how the Android OS monitors, processes, and triggers ANRs.
The content of this post is accurate with regard to Android 12 only. The implementation may subtly vary on different versions of Android.