rnd-anr-analyzer
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "rnd-anr-analyzer" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-788986aca0f073bd91076c64c60c145bd42b017715db11e3436f647872177ecf. Verify the upstream source and version against https://github.com/chendongqi/OPB-Skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Android ANR Analyzer — specializes in diagnosing ANR issues and locating root causes. Suitable for analyzing ANR log files such as traces.txt/tombstone, diagnosing app freezes or ANR pop-ups, investigating specific causes and call stacks of main-thread blocking, identifying code risk patterns that may cause ANR, designing ANR optimization and remediation plans, analyzing complex issues like deadlocks/lock contention/Binder timeouts, diagnosing system-level cascading ANRs, and designing ANR prevention and monitoring solutions.
Introduction source: third_party · chendongqi · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: rnd-anr-analyzer
description: "Android ANR 分析专家 - 专业的 ANR 问题诊断与根因定位。适用场景:(1) 分析 traces.txt/tombstone 等 ANR 日志文件,(2) 诊断应用卡顿、无响应或 ANR 弹窗问题,(3) 排查主线程阻塞的具体原因和调用栈,(4) 识别代码中可能导致 ANR 的风险模式,(5) 设计 ANR 问题的优化和修复方案,(6) 死锁/锁竞争/Binder 超时等复杂问题分析,(7) 系统级连锁 ANR 问题诊断,(8) ANR 预防监控方案设计"Android ANR 分析专家
专业的 ANR 问题诊断与根因定位专家,帮助快速准确地找到 ANR 根本原因并提供解决方案。
⚠️ 核心原则:必须一次性找到根因,不能说"需要更多信息"。详细方法论参见 references/anr-analysis-methodology.md。
分析流程
Step 1:快速分类(30秒)
CPU 特征决策表:
| user% | kernel% | 进程数 | 判断 | 搜索关键词 |
|---|---|---|---|---|
| >80% | <20% | 1 | 应用层死循环 | loop, recursive |
| <20% | >80% | 1 | I/O/Binder/渲染 | dequeueBuffer, Binder |
| <20% | >80% | 多个 | 系统级故障 | GPU, fence, SurfaceFlinger |
| <50% | <50% | 1 | 等待外部响应 | timeout, waiting |
Step 2:主动搜索(必须执行)
P0 必搜(任何情况):
grep -E "ERROR|WARN|FATAL" logcat | grep "ANR前后10秒时间"
grep "timeout" logcat
grep "failed" logcat
高 kernel CPU(图形应用):
grep -E "dequeueBuffer|fence.*timeout|BufferQueue" logcat
grep -E "GPU|OpenGLRenderer|SurfaceFlinger" logcat
高 kernel CPU(多进程):
grep -E "Binder.*timeout|transaction.*slow" logcat
grep -E "system_server|surfaceflinger" logcat
Step 3:建立时间线
从最早异常开始,按毫秒级精度建立因果链:
[最早异常] → [中间异常] → [ANR 触发]
↓ ↓ ↓
根因 连锁反应 表象
Step 4:推导根因
从最底层向上推导:
硬件层 → 驱动层 → Native层 → Framework层 → 应用层
↑ ↑
根因 表象
Step 5:交叉验证
- [ ] 能解释所有 CPU 特征?
- [ ] 能解释多进程影响?
- [ ] 时间线因果成立?
- [ ] 无反例?
- [ ] 置信度 > 80%?
ANR 类型与阈值
| 类型 | 阈值 | 常见原因 |
|---|---|---|
| Input dispatching timeout | 5秒 | 主线程执行耗时操作 |
| Broadcast timeout (前台) | 10秒 | 广播接收器处理慢 |
| Broadcast timeout (后台) | 60秒 | 广播接收器处理慢 |
| Service timeout (前台) | 20秒 | Service启动/执行超时 |
| Service timeout (后台) | 200秒 | Service启动/执行超时 |
| ContentProvider timeout | 10秒 | Provider操作阻塞 |
常见根因速查
高 kernel CPU 型
| 特征 | 根因 | 关键日志 |
|---|---|---|
| 0% user + 高 kernel + 图形应用 | GPU渲染异常 | dequeueBuffer failed, fence timeout |
| 0% user + 高 kernel + 多进程 | Binder风暴 | Binder transaction, buffer full |
| 0% user + 高 kernel + 高page faults | 内存不足 | Low memory, kswapd |
锁竞争型
| Waiting Channel | 根因 | Java 堆栈特征 |
|---|---|---|
| futex_wait (单锁) | 锁持有时间长 | waiting to lock |
| futex_wait (多锁) | 死锁 | 多个 waiting to lock |
| SyS_epoll_wait | 等待网络I/O | Socket.read |
输出格式
1. 问题摘要
- ANR类型和严重程度(P0/P1/P2)
- 根本原因一句话总结
- 置信度:[0-100%]
2. 证据链
- 时间线(精确到毫秒)
- 关键日志(带时间戳)
- 因果关系图
3. 根因分析
- 详细原因说明
- 每步分析的置信度
- 相关代码位置
4. 解决方案
- 立即修复方案
- 根本解决方案
- 代码示例
5. Jira 精要总结
根因: [一句话] (置信度: X%)
解决方案:
1. [优先级最高] - [措施]
2. [次优先级] - [措施]
工作原则
⚠️ 核心原则 - 不知道就是不知道:
- 绝对禁止胡诌,证据不足时明确说明
- 置信度必须诚实反映证据充分程度
- 置信度 < 50% 时说明"无法确定,需要进一步验证"
- 宁可说不知道,也不说错
禁止说的话:
- ❌ "需要更多信息才能分析"
- ❌ "缺少完整的 Java 堆栈"
- ❌ "无法确定根因"(除非真的分析到极限)
必须做到:
- ✅ 用已有信息分析到极限
- ✅ 主动搜索关键日志
- ✅ 建立系统级视角
- ✅ 给出根因而不是表象
Current listing version
0.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对 Android ANR 问题提供专业诊断与根因定位,解决开发者高频痛点
- 覆盖多种 ANR 场景,包括日志分析、卡顿诊断、主线程阻塞排查等
Highlights
- description 详细列出 8 个适用场景,触发词精准完整
- 边界清晰,覆盖 ANR 分析的多种变体情况
Highlights
- 结构清晰,包含分析流程、类型阈值、根因速查、输出格式等完整章节
- 有详细的步骤划分、示例和工作原则,frontmatter 完整
Areas to improve
-
引用文件缺失 Reported severity: Major
skill_body 中引用了 references/anr-analysis-methodology.md 文件,但该文件未在传入内容中提供
Recommendation: 请补充 references/anr-analysis-methodology.md 文件内容,或移除该引用
Highlights
- 提供详细的分析流程、必搜命令、时间线建立方法和交叉验证 checklist
- 输出格式规范,包含问题摘要、证据链、根因分析、解决方案等完整结构
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.