Mobile Development 8 min read

Analysis of Android ANR (Application Not Responding) Causes and Diagnosis

The article explains that Android ANR (Application Not Responding) arises when the UI thread is blocked beyond defined timeouts, classifies the various timeout types, details common root causes such as slow I/O, heavy computation, binder delays, deadlocks, CPU or memory pressure, and outlines a systematic log‑and‑systrace analysis process to pinpoint and resolve these issues.

OPPO Kernel Craftsman
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Analysis of Android ANR (Application Not Responding) Causes and Diagnosis

ANR (Application Not Responding) occurs when the UI thread of an Android app is blocked for too long, triggering a system dialog that allows the user to force‑quit the app.

ANR Classification

• Input dispatching timed out – >5 s for key or touch events. • Broadcast of Intent – 10 s for foreground, 60 s for background. • Executing service – 20 s for foreground, 200 s for background. • ContentProvider – rarely, publish not completed within 10 s. • startForegroundService without startForeground within 5 s.

Root Cause Analysis

1. Common patterns when diagnosing ANR: a) Slow I/O operations on the main thread (complex layouts, frequent I/O). b) Long‑running computations on the main thread. c) Synchronous binder calls to another process that take a long time. d) Main thread blocked waiting for a long operation in another thread. e) Deadlock involving the main thread.

2. Specific causes identified in logs: • Blocking operations, suspends, deadlocks, infinite loops on the UI thread. • CPU resource contention – high CPU usage by other processes prevents the app from obtaining time slices. • Binder resource exhaustion – delayed inter‑process communication. • Memory pressure – low‑memory killer activity, frequent GC, or memory leaks. • GPU rendering stalls, Block I/O delays, native crashes, watchdog triggers, etc.

Log Analysis Procedure

Search Android system logs for the keyword “ANR in” to obtain the affected process, PID, and ANR type. Then examine:

CPU load and memory pressure.

Binder transaction logs.

Top‑process CPU usage to see if the ANR app has insufficient CPU time.

Systrace or additional trace logs for deeper insight.

Typical examples from a banking app illustrate issues such as Block I/O, GPU rendering delays, SDK adaptation problems, camera module failures, audio module crashes, APK signature verification, permission interception, provider timeouts, park lock contention, CPU time‑slice shortage, empty processes, and chipset performance limits.

Conclusion

Beyond simple timeout detection, ANR can be caused by system‑level factors like high kswapd0 activity, CPU saturation, or binder exhaustion. Comprehensive analysis requires correlating ANR traces with system logs, searching for relevant keywords, and reviewing systrace or auxiliary data to pinpoint the root cause.

debuggingMobile DevelopmentperformanceAndroidANR
OPPO Kernel Craftsman
Written by

OPPO Kernel Craftsman

Sharing Linux kernel-related cutting-edge technology, technical articles, technical news, and curated tutorials

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.