patch_apk_project
Edit smali, AndroidManifest.xml, or resource XML files in an apktool-decoded project by replacing exact text, with ambiguity checks and hash-tracked changes for in-place patching.
Instructions
Edit a text file inside an apktool-decoded project - a smali file, AndroidManifest.xml or a resource XML - by replacing exact text. It fails unless the text is found, and unless it matches exactly once (set all to replace every match); binary files, files over 5 MB and paths that leave the project are refused. Each patch is saved as a record of what changed, with before/after hashes, so the modification is tracked. Returns { projectDir, patchedFile, replacements, sha256Before, sha256After, outputPath }. It edits the project in place: rebuild with build_apk and sign with sign_apk afterwards. Only use it on apps you own or are authorized to modify.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all | No | Replace every match. By default the text must match exactly once, so an ambiguous edit fails instead of changing the wrong place. | |
| file | Yes | Path of the file to edit, relative to the project, e.g. "smali/com/acme/Login.smali" or "AndroidManifest.xml". | |
| find | Yes | The exact text to replace. Plain text, not a pattern; must not be empty. | |
| replace | Yes | The text to put in its place. May be empty to delete the matched text. | |
| workspace | No | Workspace name (not id). Created if it doesn't exist, and this call is recorded as a job in its history. Defaults to "default". | |
| projectDir | Yes | Absolute path to the decoded project directory - the outputDir returned by decode_apk. Must contain apktool.yml. |