Apktool – Tool For Reverse Engineering Android apk Files

Last Release: 03/03/2019     Last Commit: 09/09/2019

Apktool – Tool For Reverse Engineering Android apk Files

Introduction

Apktool is a tool for reverse engineering 3rd party, closed, binary Android apps. With this tool you can decode resources to nearly original form, modify them and rebuild them. In addition, it’s easy to work with since it has automation of some repetitive tasks, such as building apk, etc.

Apktool Logo
Disclaimer: This tool is NOT intended for piracy and other non-legal uses! Use it for localizing, adding features or support for custom platforms and other GOOD purpose.

Apktool: A Tool For Reverse Engineering Android apk Files

Features:

  • Disassembling resources to nearly original form (including resources.arsc, classes.dex, 9.png. and XMLs)
  • Rebuilding decoded resources back to binary APK/JAR
  • Organizing and handling APKs that depend on framework resources
  • Smali Debugging (Removed in 2.1.0 in favor of IdeaSmali)
  • Helping with repetitive tasks

Requirements:

  • Java 7+ (JRE 1.7)
  • Basic knowledge of Android SDK, AAPT and smali

Apktool Install

Linux (Ubuntu)

Download Linux wrapper script (Right click, Save Link As apktool) or:

$ cd /usr/local/bin/
$ curl https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool > apktool
Note: Wrapper scripts are not needed, but helpful so you don’t have to type java -jar apktool.jar over and over.

Then download the newest apktool:

$ wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.3.4.jar
Since root is needed, don’t forget to move both files, apktool.jar & apktool, to /usr/local/bin/.

After download, rename downloaded jar to apktool.jar, and make sure both files are executable:

$ mv apktool_2.3.4.jar apktool.jar
$ chmod +x apktool
$ chmod +x apktool.jar

Now you can run it, as follows:

$ apktool

Installation steps are almost identical for both Windows and OS X, check here.

Build Apktool from source

Clone it from the GitHub repo, and navigate to the working directory:

$ git clone https://github.com/iBotPeaches/Apktool.git
$ cd Apktool

Then build with the following:

$ [./gradlew][gradlew.bat] build shadowJar

After build completes you should have a jar file at: ./brut.apktool/apktool-cli/build/libs/apktool-xxxxx.jar

Basic Usage

Apktool v2.3.4 - a tool for reengineering Android apk files
with smali v2.2.3-dev and baksmali v2.2.3-dev
Copyright 2014 Ryszard Wiśniewski <brut.alll@gmail.com>
Updated by Connor Tumbleson <connor.tumbleson@gmail.com>

usage: apktool
 -advance,--advanced   prints advance information.
 -version,--version    prints the version then exits
usage: apktool if|install-framework [options] <framework.apk>
 -p,--frame-path <dir>   Stores framework files into <dir>.
 -t,--tag <tag>          Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
 -f,--force              Force delete destination directory.
 -o,--output <dir>       The name of folder that gets written. Default is apk.out
 -p,--frame-path <dir>   Uses framework files located in <dir>.
 -r,--no-res             Do not decode resources.
 -s,--no-src             Do not decode sources.
 -t,--frame-tag <tag>    Uses framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
 -f,--force-all          Skip changes detection and build all files.
 -o,--output <dir>       The name of apk that gets written. Default is dist/name.apk
 -p,--frame-path <dir>   Uses framework files located in <dir>.

For additional info, see: http://ibotpeaches.github.io/Apktool/ 
For smali/baksmali info, see: https://github.com/JesusFreke/smali

Decoding example:

$ apktool d test.apk
I: Using Apktool 2.3.4 on test.apk
I: Loading resource table…
I: Decoding AndroidManifest.xml with resources…
I: Loading resource table from file: 1.apk
I: Regular manifest package…
I: Decoding file-resources…
I: Decoding values / XMLs…
I: Baksmaling classes.dex…
I: Copying assets and libs…
$
Documentation Box
Download Box