Extract Apk logo

Extract Apk

Community
niki914
extract-apk

定位、提取并反编译 Android APK:按关键字在设备上搜索包名、用 adb 导出 APK(含 split)、再用 jadx 反编译成可检索的源码树,并输出三个可预测的产物路径。当用户想拿到某个 App 的反编译代码、只知道 App 中文名/模糊名字、需要从已连接设备导出 APK,或需要把 APK 变成 sources/ 目录时使用。

Overview

Publisherniki914
Repositoryzafiro
Skill nameextract-apk
Stars
305
Forks
50
Bundled files
4
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by niki914 on GitHub. Read the source before you install it.

Installation

Install the Extract Apk AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/niki914/zafiro/tree/main/.agents/skills/extract-apk
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/niki914/zafiro.git /tmp/zafiro
mkdir -p .claude/skills
cp -r /tmp/zafiro/.agents/skills/extract-apk .claude/skills/extract-apk
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Extract Apk in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Extract Apk on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Extract Apk is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

extract-apk

把「人类口中一个 App」变成「本地一份可检索的反编译源码树」。三个脚本,一条直线,不做别的事。

边界

做:搜索包名 → 提取 APK → 反编译 → 打印规范产物路径。

不做:不读反编译产物里的源码、不看 AndroidManifest.xml 内容、不生成 hook 配置、不做静态分析。读到路径就结束,源码阅读交给下游流程。

如果越界去读源码,会把本应属于静态分析阶段的上下文窗口消耗掉。

环境前置

脚本目录:<本 skill 目录>/scripts/,下文命令都用 python3 <脚本绝对路径> 调用,不要 cd 进去。

依赖三项:adb(设备侧)、java(jadx 运行时)、jadx(反编译器)。

  • 缺 jadx:脚本会自己用 brew list --formula jadx 判断是不是装了没进 PATH,并给出确切安装命令。不要自动安装,把命令给用户确认。
  • 缺 java:脚本会提示 brew install openjdk。
  • 设备未就绪:脚本会打印 adb devices 的实际输出;多设备时用 --serial,或设 ANDROID_SERIAL。

三步流水线

1. 搜索包名

python3 <scripts>/search_app.py <keyword> [--limit N] [--serial SERIAL]

关键字做包名子串匹配,大小写不敏感。搜不到就换更短的关键字(品牌名 / 域名片段)重试,不要猜包名。

关于应用显示名:adb 拿不到 label(pm list packages 和 dumpsys package 都没有这个字段,设备上也没有 aapt)。所以英文系统下搜 wechat、line、telegram 这类"界面上的名字"会命中 0 条。此时脚本会自动列出设备上全部第三方包(pm list packages -3)供按语义挑选,例如 com.tencent.mm、tv.danmaku.bili。不要自己编造包名,从这份列表里选。

2. 提取 APK

python3 <scripts>/extract_apk.py <package_name> [--serial SERIAL] [--force]
  • 单个 APK → 存成 <root>/extracted_apps/<包名下划线化>.apk。
  • 检测到 split → 全部拉到 <root>/extracted_apps/<包名下划线化>_splits/,base.apk 在内。不要只拿 base.apk:缺 split 会导致 jadx 资源解析缺失,静态事实失真。
  • 目标已存在时直接返回既有路径(status: cached),不重复下载;要重拉加 --force。

3. 反编译

python3 <scripts>/decompile_apk.py <apk_文件或_splits_目录> [--force] [--no-res]
  • 传目录时会把目录内所有 *.apk(base.apk 优先)一次性喂给 jadx,这是 split 场景的正确用法。
  • 产物已存在且 sources/ 完整 → status: cached 直接返回,不重跑。
  • --no-res 只产出 sources,跳过资源解析,用于超大 App 抢时间。

jadx 是分钟级任务,必须用后台方式执行(例如 bg_run),不要在前台阻塞等。脚本自身按百分比打印进度到 stderr。

产物路径约定

根目录默认是运行脚本时的工作目录下的 .apk_decs/(Path.cwd() / ".apk_decs"),可用环境变量 APK_DECS_ROOT 覆盖成别的绝对路径。

因为默认跟 cwd 走,运行前先确认自己在对的工作目录:脚本用绝对路径调用,产物就会落在你当时所在目录。要固定到某处,直接设 APK_DECS_ROOT。

<cwd>/.apk_decs/extracted_apps/<包名下划线化>.apk      # 单 APK
<cwd>/.apk_decs/extracted_apps/<包名下划线化>_splits/  # split 场景
<cwd>/.apk_decs/<apk_stem>_apk/sources/                # Java 源码根
<cwd>/.apk_decs/<apk_stem>_apk/resources/AndroidManifest.xml
<cwd>/.apk_decs/<apk_stem>_apk/.rgignore               # 已忽略框架/资源噪声,可直接给 rg 用
<cwd>/.apk_decs/<apk_stem>_apk/jadx.log                # jadx 完整输出

<apk_stem> 由输入推导:文件取去扩展名,*_splits 目录去掉 _splits 后缀。

脚本 stdout 是稳定的 key: value 行,固定包含 sources_path、manifest_path(不存在时为 null)、output_dir(绝对路径)。下游流程只需要读这几个字段。

失败处理

现象处理
matched: 0显示名搜不到属正常(见上文 label 说明),从脚本输出的 device_package 列表里按语义挑
未找到该包应用没装:adb shell pm list packages 确认,或换设备
拉取失败多为设备连接、权限或存储不足,向用户升级,不要重试循环
jadx 未产出 sources 目录真失败:日志尾部已随错误打印,完整日志在 <out>/jadx.log;加 --force 重跑
警告:jadx 退出码 1不是失败。真实 APK 总有部分类反编译不了,只要 sources/ 产出就算成功;错误数在 jadx.log 里搜 finished with errors
反编译极慢或 OOM加大内存:设 JADX_OPTS=-Xmx8g;或先 --no-res

自检

改过脚本后跑一次共享工具的自检(纯断言,无依赖):

python3 <scripts>/_common.py

覆盖点:package: 行解析、base.apk 选取、包名归一化、split 目录输入排序、stem 推导、进度解析(jadx 1.5 是 progress: N of M (P%),取括号内百分比)、线程/内存启发值。改动解析逻辑后这个自检必须过。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Extract Apk AI skill do?

定位、提取并反编译 Android APK:按关键字在设备上搜索包名、用 adb 导出 APK(含 split)、再用 jadx 反编译成可检索的源码树,并输出三个可预测的产物路径。当用户想拿到某个 App 的反编译代码、只知道 App 中文名/模糊名字、需要从已连接设备导出 APK,或需要把 APK 变成 sources/ 目录时使用。

Why use Extract Apk on TypingMind?

Because you install it once and use it with any model. Extract Apk is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Extract Apk in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/niki914/zafiro/tree/main/.agents/skills/extract-apk. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Extract Apk?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Extract Apk?

As many as you like. As long as a model supports skills, you can use Extract Apk with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Extract Apk AI skill free?

Yes. It is published on GitHub by niki914 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇