When an Android app freezes long enough for the system to show the dreaded "App Not Responding" (ANR) dialog, you lose productivity and confidence in the device. Unlike a simple crash, an ANR indicates that the app’s main (UI) thread is blocked, often for more than five seconds. This tutorial shows you how to capture the exact moment an ANR occurs, read the relevant logs, and apply practical fixes—all without rooting the phone.
Settings → About phone.Build number and tap it seven times. You’ll see a toast confirming "You are now a developer!".Developer options appears.Developer options and toggle USB debugging on. Confirm the prompt that appears.On some OEM skins (e.g., Samsung One UI, Xiaomi MIUI) the path may be Settings > System > Developer options or similar. The wording of the toggle is usually "USB debugging" or "Android debugging".
If you already have the Android SDK Platform‑Tools, skip to the next section. Otherwise:
C:\adb or ~/adb).PATH so you can run adb from any terminal.adb version to verify the installation.If the command prints a version number, you’re ready.
adb devices. You should see a line like xxxxxx device.If the device shows as unauthorized, re‑authorize the computer on the phone.
Android writes ANR information to two places:
/data/anr/traces.txt file (requires root to read directly).bugreport bundle, which includes the same traces and is accessible via ADB without root.We will use the bugreport method because it works on any device.
adb logcat -v threadtime *:W > anr_log.txt
logcat will record all warning‑level messages and above.
The file anr_log.txt now holds the raw Logcat output. Look for a line containing ANR in – it will be followed by the package name and a stack dump.
If you want a more comprehensive view (including system services), run:
adb bugreport bugreport.zip
After the command finishes, unzip the archive and open bugreport.txt. Search for "ANR" to locate the same trace.
An ANR trace typically looks like this (simplified):
ANR in com.example.myapp (com.example.myapp/.MainActivity)
pid: 1234
tid: 1234
name: main
uid: 10123
state: R
stack:
at android.view.ViewRootImpl$W.performTraversals(ViewRootImpl.java:2520)
at android.view.ViewRootImpl$W.handleMessage(ViewRootImpl.java:2362)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7615)
...
Key elements to read:
If the top of the stack shows android.database.sqlite.SQLiteDatabase, the app may be waiting on a database lock. If you see java.io.FileOutputStream, it could be a slow file write.
Most end‑users cannot modify the app’s source code, but many ANR causes are addressed by system‑level actions.
Settings → Apps & notifications (or Apps on older Android).Storage & cache → Clear cache.
Cache files can become corrupted and cause the UI thread to wait indefinitely on I/O.
This kills any stuck background threads that might be holding a lock.
Developers often fix ANR‑causing bugs in newer releases.
Google Play Store, tap your profile icon → Manage apps & device → Updates available.Settings → Apps → Uninstall.
This clears both cache and data, giving the app a clean slate. Warning: Any local data (e.g., offline notes) will be lost unless you back it up first.
Sometimes a mis‑configured permission or default action can freeze the UI.
Settings → System → Reset options (or Advanced → Reset app preferences on some devices).This does not delete app data but restores permission defaults.
Safe mode disables all third‑party apps, letting you test whether the ANR is caused by another app interfering.
Now launch the problematic app. If the ANR disappears, a recently installed third‑party app is likely the culprit. Uninstall recent apps one by one to isolate the offender.
Android releases often contain performance improvements and bug fixes that resolve ANR‑related framework issues.
Settings → System → System update.Heavy background services (e.g., sync, location, or heavy widgets) can starve the UI thread of CPU time.
Settings → Apps → Battery → Background restriction.Adaptive battery for a short test.
If you prefer command‑line, ADB can clear cache, force stop, or uninstall apps without navigating the UI.
# Clear cache
adb shell pm clear com.example.myapp
# Force stop
adb shell am force-stop com.example.myapp
# Uninstall (keep data) – useful for a clean reinstall
adb uninstall com.example.myapp
# Re‑install from an APK you trust
adb install path/to/app.apk
Replace com.example.myapp with the actual package name you saw in the ANR trace.
Logcat contains many messages; you can narrow the output to only ANR‑related entries.
adb logcat -b events -v threadtime | grep -i "ANR"
The -b events buffer includes system events like ANR reports. This command prints only lines that contain the word "ANR" (case‑insensitive). If you see nothing, the device may not have recorded the event because the ANR dialog was dismissed too quickly. In that case, repeat the capture with a longer log window.
logcat before reproducing the issue. Some devices buffer logs only for a short period.adb bugreport instead, as described in section 4.2.If you have exhausted the steps above and the ANR persists, the issue is likely a bug in the app’s code. Provide the developer with the relevant stack trace (copy the lines from anr_log.txt) and a short description of what you were doing when the ANR occurred. Most developers appreciate a reproducible report and may issue a fix in a future update.
adb devices.By following these steps, you can turn an opaque "App Not Responding" dialog into concrete information and a clear path to resolution—without ever needing root access.









