android-anr-investigator

Diagnose Android ANRs by analyzing main-thread blocking, lock contention, and I/O waits.

1|Updated Jun 27, 2026
One-click install
npx skills add https://github.com/TE-QuanBZhang/skills-pool --skill android-anr-investigator-te-quanbzhang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-anr-investigator
Source: https://github.com/TE-QuanBZhang/skills-pool/tree/main/ai-coding/skills/android-anr-investigator
Command: npx skills add https://github.com/TE-QuanBZhang/skills-pool --skill android-anr-investigator-te-quanbzhang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Android apps freeze or trigger ANR (Application Not Responding) errors when the main thread gets blocked, and pinpointing the exact blocking call from raw stack traces is time-consuming and error-prone. This Skill provides a structured investigation workflow that turns ANR traces and thread dumps into a root-cause diagnosis with targeted fixes. ## Core Features & Use Cases - ANR Classification: Identifies whether the issue is an input dispatch timeout, broadcast receiver timeout, startup hang, or render stall. - Main Thread Analysis: Determines if the main thread is blocked on CPU work, locks, binder IPC, disk I/O, network, or coroutine misuse like runBlocking. - Root Cause & Fix Recommendations: Maps blocking patterns to concrete fixes such as moving work to Dispatchers.IO, deferring startup initialization, or reducing lock scope. - Use Case: Given an ANR trace showing the main thread waiting on a lock during app startup, the Skill traces the lock holder, identifies a synchronous database call on the main thread, and recommends moving it to a background dispatcher with validation steps. ## Quick Start Analyze this ANR trace and thread dump to find what is blocking the main thread and recommend a fix.

Frequently Asked Questions about android-anr-investigator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I investigate an Android ANR from a stack trace?

Start by identifying the ANR type, then inspect the main thread state to see if it is running CPU-heavy work, waiting on a lock, or blocked on binder, disk, or network. Correlate the first app-owned frame with your source code to find the responsible call path.

What are the most common causes of Android ANRs?

Common causes include synchronous disk or database access on the main thread, blocking binder IPC calls, image decoding on the main thread, expensive JSON parsing, lock contention, and coroutine misuse such as runBlocking on the main thread.

How do I fix main thread blocking caused by Room database calls?

Move Room database operations off the main thread by using suspend functions with Dispatchers.IO or Room's built-in async query support. Replace blocking calls with suspend APIs and validate the fix with before-and-after performance traces.

Does this ANR investigation approach work with Kotlin coroutines?

Yes, it explicitly covers coroutine-related issues such as runBlocking on the main thread, bad dispatcher choices, and blocking waits on Future or CountDownLatch. It recommends structured concurrency and proper dispatcher selection as fixes.

Why does my app freeze on startup without a clear crash?

Startup hangs usually come from a long synchronous dependency chain on the main thread. Separate must-have initialization from deferrable work, move heavy setup to background threads, and measure the startup critical path with traces.