Seeing the dreaded "App isn’t responding" dialog is frustrating, especially when it happens to a favorite app. Android shows this dialog when the main (UI) thread has been blocked for more than five seconds. The block can be caused by anything from a slow network call to a misbehaving broadcast receiver. This tutorial walks you through a repeatable, low‑risk workflow that captures the exact moment the ANR occurs, decodes the log, and gives you concrete actions to fix the problem.
Make sure you have a computer with Android Platform‑Tools (ADB) installed, a USB cable, and the device charged to at least 50 %.
adb devices
You should see a line with the device serial number and the word device. If not, install the appropriate USB driver for your phone’s manufacturer.adb logcat -c-b main flag limits output to the primary buffer, which contains ANR messages.
adb logcat -b main -v time > anr_log.txt
Leave this command running – it will keep appending lines until you stop it (Ctrl + C).At this point you have a raw log file that includes the system’s diagnosis of why the UI thread stalled.
anr_log.txt in a text editor that can handle large files (e.g., Notepad++, VS Code).ANR in. The line you are looking for typically looks like:
04-12 14:23:45.123 1234 5678 I ActivityManager: ANR in com.example.myapp (com.example.myapp/.MainActivity)
The package name (here com.example.myapp) tells you which app triggered the timeout.The stack trace appears a few lines after the ANR line and starts with something like DALVIK THREAD or main. Example:
04-12 14:23:45.130 1234 5678 D AndroidRuntime: Shutting down VM04-12 14:23:45.131 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.132 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.133 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.134 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.135 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.136 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.137 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.138 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.139 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.140 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.141 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.142 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)04-12 14:23:45.143 1234 5678 D AndroidRuntime: threadid=1: still suspended after undo (sc=1)
What you are looking for are lines that reference the main thread or a specific component such as ActivityThread. The deepest method call before the block tells you what code was executing when the UI stopped responding.
Typical culprits fall into three categories:
startForeground().Match the method name from the stack trace to one of these categories. For example, a line like com.example.myapp.network.ApiClient.fetchData(ApiClient.java:112) points directly to a network call on the UI thread.
Most users will never need to modify the app’s source code. The goal of this tutorial is to get the app working again using safe, user‑level actions.
adb shell pm clear com.example.myapp
This command clears both cache and data, so be sure you have a backup if the app stores important information locally.adb shell am force-stop com.example.myapp
Then open the app again.
If the log points to a specific component, you can try more focused actions.
.execute() or .get() on an HttpURLConnection or Retrofit call.
BroadcastQueue.processNextBroadcast.
ServiceRecord.startRequested followed by a long pause.
android.database.CursorWrapper.
When the basic steps don’t pinpoint the problem, you can gather a full bug report.
adb bugreport bugreport.zip
This creates a compressed archive containing system logs, tombstones, and the last ANR report.
system_log.txt. Search for ANR again – the bug report often includes extra fields like ActivityManager: ANR in … (reason=…) that clarify whether the timeout was caused by a broadcast, a service, or a content provider.Advanced users can also use adb shell dumpsys activity services to list all running services and their start times, helping you spot a service that never finishes its initialization.
adb logcat -b all to capture every buffer.
adb logcat -b main -v time -t 60 > anr_last_minute.txt captures only the last 60 seconds.
pm clear, export any needed data via the app’s own export feature or by copying its files from /sdcard/Android/data/… (if accessible).
Even after you fix the immediate issue, it’s worth tightening the device’s overall health to avoid new ANRs.
If you have tried the steps above and the ANR persists with the same stack trace, the root cause is likely inside the app’s code. In that case:
Providing a clear, timestamped snippet from your Logcat makes it far easier for developers to reproduce and fix the bug.
ANR dialogs are Android’s way of telling you that something on the UI thread is taking too long. By capturing Logcat with ADB, filtering for the ANR line, and interpreting the stack trace, you can quickly identify whether the problem lies in the app’s cache, a network call, a broadcast receiver, or a service. The tutorial walks you through safe user‑level fixes – clearing cache, updating, or disabling the offending component – and offers advanced diagnostics for stubborn cases. With these tools in hand, you’ll turn “App isn’t responding” from a mystery into a manageable, solvable event.









