跳到正文
Skillpedia
移动应用10k · #11926

anr-audit-and-fix

它能做什么

这个技能检查 Android 代码中导致应用无响应(ANR)卡死的风险,并解释 ANR 堆栈转储。适合在应用中遇到卡死或 ANR 报告的 Android 开发者。

适用场景

  • ✓当你想扫描 Android 代码中阻塞主线程的工作时。
  • ✓当你有一份 ANR 堆栈转储或跟踪记录,并想知道是什么原因导致的时候。
  • ✓当 Google Play 或你的崩溃工具报告 ANR 错误,并且你需要可能的修复方法的时候。

技能链接

https://github.com/android/skills/blob/main/performance/anr-audit-and-fix/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/android/skills/blob/main/performance/anr-audit-and-fix/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“这是我们应用的一份 ANR 跟踪记录。请告诉我原因是什么,以及应该修复什么。”

每周 5 个新技能,1 分钟读完。

工作原理

对于代码,该技能会列出有风险的调用,证明它们在哪个线程上运行,以及它们是否真的会阻塞,然后对每项进行评级。对于跟踪记录,它会遵循既定的跟踪分析指南,并仅根据日志证据撰写报告。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Select the execution path matching the user's request:

1. Path A: Static codebase ANR risk audit

When auditing source files or scanning for thread-blocking operations:

  • Follow references/risk_analysis_guide.md step by step: list candidates, prove the executing thread (trace callers when the thread depends on them), prove the call blocks, then attribute and grade. Report only candidates that pass these checks; list the dismissed ones separately with a one-line reason.
  • Evaluate off-main-thread mutations of attached Views not merely as crash risks (CalledFromWrongThreadException), but as Sync Barrier Leak ANR risks with their own proof (off-main execution plus an attached View).

2. Path B: Trace-driven diagnosis and remediation

When analyzing ANR traces or stack dumps:

常见问题

它会列出每一个慢调用吗?

不会。它只报告能够证明的风险,并把被排除的项目单独列出,附上简短理由。

它会为每个 ANR 提出修复方案吗?

只会针对应用自身的问题。外部瓶颈等应用之外的原因,不会给出应用端的修复方案。

它涵盖崩溃和掉帧吗?

不涵盖。非 ANR 崩溃、掉帧和系统跟踪不在本技能的范围之内。

详情

作者的原始描述

Audits Android codebases for ANR risks and diagnoses ANR stack dumps. Use this skill when scanning Android code for ANR risks or triaging ANR stack dumps. Don't use for non-ANR crashes, dropped frames, general CPU profiling, or Perfetto system traces.

repo: android/skills

热度

GitHub 星标
10k
排名
#11926
许可证
Apache-2.0
更新时间
2026/10/29

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能