Skip to content

ANR Reports

Retrieving Application Not Responding (ANR) reports for a package from the device's DropBox (adb shell dumpsys dropbox --print data_app_anr system_app_anr) — the same store adb bugreport and DropBoxManager read. get_anr_reports parses each ====-delimited entry (timestamp/tag header, Key: value header block, trace body), filters to the entries whose recorded Process: / Package: matches the requested package, and returns them newest first with a bounded limit. include_traces=false drops the thread dumps for small headers-only responses. No root required; DropBox is size-capped and rotates, so an empty result means "none currently stored".

get_anr_reports

Get a package's ANR reports from the device's DropBox (adb shell dumpsys dropbox --print data_app_anr, and again for system_app_anr).

DropBox is the system store DropBoxManagerService keeps for crash / ANR records (the same source adb bugreport and DropBoxManager read). dumpsys dropbox --print accepts one tag at a time, so this queries both ANR tags, parses each entry's header block and body, and returns the ones whose recorded process/package matches package_name, newest first. No root required. Reading only — DropBox isn't modified.

DropBox is size-capped and rotates, so ANRs older than roughly the last day or the last few hundred records may already have aged out; an empty result means "none currently in DropBox", not "this app never ANR'd".

Parameters:

Name Type Description Default
serial str

The target device's adb serial (see list_connected_devices).

required
package_name str

The package whose ANRs to fetch, e.g. "com.example.app". Matched against each entry's Process:/Package: header.

required
limit int

Maximum number of reports to return, newest first, 1-50 (default 5).

5
include_traces bool

When true (default) each report carries its full trace body (thread dumps, CPU usage), capped in length. Set false to get just the headers and subject line — much smaller responses when you only need to know that/when ANRs happened.

True

Returns:

Type Description
AnrReportList

The serial, package_name, count, and reports — each with tag ("data_app_anr" / "system_app_anr"), timestamp (device-local, verbatim), process, package, pid, uid, flags, subject (the "ANR in ..." line when present), size_bytes, and trace (null when include_traces is false). An empty reports list is a normal result.

Error handling

A blank package_name or an out-of-range limit raises INVALID_ARGUMENT before anything runs. An unknown serial or unresponsive adb binary raises DEVICE_NOT_FOUND/ADB_UNAVAILABLE. A permission rejection raises PERMISSION_DENIED; any other non-zero exit raises BACKEND_ERROR. "(No entries found.)" is a normal empty result, not an error.

Example

Called with serial="emulator-5554", package_name="com.example.app", include_traces=false. A typical response:

{
  "status": "success",
  "message": "1 ANR report for com.example.app on emulator-5554 (newest 2026-09-06 16:52:25).",
  "data": {
    "serial": "emulator-5554",
    "package_name": "com.example.app",
    "count": 1,
    "reports": [
      {
        "tag": "data_app_anr",
        "timestamp": "2026-09-06 16:52:25",
        "process": "com.example.app",
        "package": "com.example.app",
        "pid": 12345,
        "uid": 10234,
        "flags": "0x30c8be45",
        "subject": "ANR in com.example.app (com.example.app/.MainActivity)",
        "size_bytes": 40219,
        "trace": null
      }
    ]
  },
  "error": null
}