Reverse Engineering Android apk Files: Apktool
ApkTool is a tool for reverse engineering third party, closed, binary Android apps.
It can decode resources to nearly original form and rebuild them after making some modifications; it makes possible to debug smali code step by step.
Also, it makes working with an app easier because of project-like files structure and automation of some repetitive tasks like building apk, etc.
It isn’t intended for piracy & other non-legal uses. It could be used for localizing, adding some features or support for custom platforms and other purposes.
Simply try to be fair with authors of an app, that you use and probably like.
Key Features:
- Disassembling resources to nearly original form (including
resources.arsc
,classes.dex
,9.png.
andXMLs
) - Rebuilding decoded resources back to binary APK/JAR
- Organizing and handling APKs that depend on framework resources.
- Smali Debugging (to be removed in
2.1.0
in favor of IdeaSmali) - Helping with repetitive tasks.
The Requirements:
- Java 7 (JRE 1.7)
- Basic knowledge of Android SDK, AAPT and smali
How to Build Apktool from scratch:
Apktool is a collection of one project, containing four sub-projects and a few dependencies.
- brut.apktool.lib – (Main, all the Library code)
- brut.apktool.cli – The cli interface of the program
- brut.j.dir – Utility project
- brut.j.util – Utility project
- brut.j.common – Utility project
The Requirements:
- JDK (1.7)
- git
The Build Steps:
git clone git://github.com/iBotPeaches/Apktool.git cd Apktool
./gradlew
for unix based systems orgradlew.bat
for windows.[./gradlew][gradlew.bat] build fatJar
– Builds Apktool, including final binary.- Optional (You may build a Proguard jar)
[./gradlew][gradlew.bat] build fatJar proguard
After one or two minutes you should have a jar file at:
./brut.apktool/apktool-cli/build/libs/apktool-xxxxx.jar