SKILL.md--- name: apktool description: Android APK unpacking and resource extraction tool for reverse engineering. Use when you need to decode APK files, extract resources, examine AndroidManifest.xml, analyze smali code, or repackage modified APKs. --- # Apktool - Android APK Unpacking and Resource Extraction You are helping the user reverse engineer Android APK files using apktool for security analysis, vulnerability discovery, and understanding app internals. ## Tool Overview Apktool is a tool for reverse engineering Android APK files. It can decode resources to nearly original form and rebuild them after modifications. It's essential for: - Extracting readable AndroidManifest.xml - Decoding resources (XML layouts, strings, images) - Disassembling DEX to smali code - Analyzing app structure and permissions - Repackaging modified APKs ## Prerequisites - **apktool** must be installed on the system - Java Runtime Environment (JRE) required - Sufficient disk space (unpacked APK is typically 2-5x original size) - Write permissions in output directory ## Instructions ### 1. Basic APK Unpacking (Most Common) When the user asks to unpack, decode, or analyze an APK: **Standard decode command:** ```bash apktool d <apk-file> -o <output-directory> ``` **Example:** ```bash apktool d app.apk -o app-unpacked ``` **With force overwrite (if directory exists):** ```bash apktool d app.apk -o app-unpacked -f ``` ### 2. Understanding Output Structure After unpacking, the output directory contains: ``` app-unpacked/ ├── AndroidManifest.xml # Readable manifest (permissions, components) ├── apktool.yml # Apktool metadata (version info, SDK levels) ├── original/ # Original META-INF certificates │ └── META-INF/ ├── res/ # Decoded resources │ ├── layout/ # XML layouts │ ├── values/ # Strings, colors, dimensions │ ├── drawable/ # Images and drawables │ └── ... ├── smali/ # Disassembled DEX code (smali format) │ └── com/company/app/ # Package structure ├── assets/ # App assets (if present) ├── lib/ # Native libraries (if present) │ ├── arm64-v8a/ │ ├── armeabi-v7a/ │ └── ... └── unknown/ # Files apktool couldn't classify ``` ### 3. Selective Decoding (Performance Optimization) **Skip resources (code analysis only):** ```bash apktool d app.apk -o app-code-only -r # or apktool d app.apk -o app-code-only --no-res ``` - Faster processing - Only extracts smali code and manifest - Use when you only need to analyze code logic **Skip source code (resource analysis only):** ```bash apktool d app.apk -o app-resources-only -s # or apktool d app.apk -o app-resources-only --no-src ``` - Faster processing - Only extracts resources and manifest - Use when you only need resources, strings, layouts ### 4. Common Analysis Tasks #### A. Examining AndroidManifest.xml The manifest reveals critical security information: ```bash # After unpacking cat app-unpacked/AndroidManifest.xml ``` **Look for:** - *