Top Related Projects
Dex to Java decompiler
Tools to work with android .dex and java .class files
smali/baksmali
A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
Android and Java bytecode viewer
An Open Source Java Decompiler Gui for Procyon
Quick Overview
Apktool is a powerful tool for reverse engineering Android APK files. It allows users to decode resources to nearly original form and rebuild them after making modifications. This tool is essential for analyzing, modifying, and repackaging Android applications.
Pros
- Enables easy decompilation and recompilation of APK files
- Supports decoding resources to nearly original form
- Allows for easy modification of AndroidManifest.xml and other resources
- Actively maintained with regular updates and bug fixes
Cons
- Can be used for malicious purposes if misused
- May not work perfectly with heavily obfuscated APKs
- Requires some technical knowledge to use effectively
- Legal implications of reverse engineering apps should be considered
Getting Started
To use Apktool, follow these steps:
- Download the latest version of Apktool from the official GitHub repository.
- Install Java on your system if not already installed.
- Place the
apktool.jar
file in a convenient location. - Create a wrapper script (e.g.,
apktool.bat
for Windows orapktool
for Unix-based systems) to easily run the tool.
Basic usage:
# Decode an APK
apktool d path/to/file.apk -o output_folder
# Build an APK
apktool b path/to/modified_folder -o new_file.apk
# Install framework files
apktool if path/to/framework.apk
For more detailed instructions and advanced usage, refer to the official documentation on the GitHub repository.
Competitor Comparisons
Dex to Java decompiler
Pros of jadx
- Provides a user-friendly GUI for decompiling and analyzing Android apps
- Generates more readable Java source code compared to Apktool's smali output
- Offers built-in search functionality and cross-referencing features
Cons of jadx
- May struggle with heavily obfuscated code, potentially producing less accurate results
- Lacks some of Apktool's advanced features for modifying and repackaging APKs
- Has a steeper learning curve for users familiar with Apktool's command-line interface
Code Comparison
Apktool (smali output):
.method public onCreate(Landroid/os/Bundle;)V
.locals 1
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
const v0, 0x7f030001
invoke-virtual {p0, v0}, Lcom/example/MainActivity;->setContentView(I)V
return-void
.end method
jadx (Java output):
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Tools to work with android .dex and java .class files
Pros of dex2jar
- Focuses specifically on converting DEX to JAR files, making it more specialized for this task
- Generally faster for DEX to JAR conversion due to its specialized nature
- Lighter weight and easier to integrate into other tools or workflows
Cons of dex2jar
- Limited functionality compared to Apktool's broader feature set
- Less active development and community support
- May not handle some complex APK structures as well as Apktool
Code Comparison
Apktool (decoding an APK):
ApkDecoder decoder = new ApkDecoder();
decoder.setApkFile(new File("example.apk"));
decoder.setOutDir(new File("output"));
decoder.decode();
dex2jar (converting DEX to JAR):
DexFileReader reader = new DexFileReader(new File("classes.dex"));
BaksmaliBaseDexExporter baksmaliBaseDexExporter = new BaksmaliBaseDexExporter();
baksmaliBaseDexExporter.exportToJar(reader, new File("output.jar"));
Both tools serve different primary purposes, with Apktool offering a more comprehensive APK manipulation toolkit, while dex2jar excels at the specific task of DEX to JAR conversion. The choice between them depends on the specific requirements of your project.
smali/baksmali
Pros of smali
- More focused and specialized for Dalvik bytecode assembly/disassembly
- Lighter weight and potentially faster for specific smali-related tasks
- Provides a more direct and low-level approach to working with smali code
Cons of smali
- Limited scope compared to Apktool's broader feature set
- Lacks built-in APK handling and resource management capabilities
- May require additional tools for complete APK analysis and modification
Code Comparison
Smali (disassembling a method):
.method public onCreate(Landroid/os/Bundle;)V
.locals 1
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
const v0, 0x7f030001
invoke-virtual {p0, v0}, Lcom/example/MyActivity;->setContentView(I)V
return-void
.end method
Apktool (decompiling an APK):
apktool d app.apk -o output_folder
While smali focuses on bytecode manipulation, Apktool provides a more comprehensive solution for APK reverse engineering, including resource extraction and modification. The choice between the two depends on the specific requirements of the task at hand.
A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
Pros of bytecode-viewer
- More comprehensive analysis tool with support for multiple file formats (JAR, class, APK, DEX, and more)
- Includes a suite of plugins for advanced analysis and manipulation
- Offers a graphical user interface for easier navigation and visualization
Cons of bytecode-viewer
- Larger file size and more complex setup compared to Apktool
- May have a steeper learning curve for beginners due to its extensive features
- Can be slower for simple APK decompilation tasks
Code Comparison
Apktool (command-line usage):
apktool d app.apk -o output_folder
bytecode-viewer (Java code for programmatic usage):
BytecodeViewer.openFiles(new File("app.apk"));
BytecodeViewer.exportJar(new File("output.jar"));
Both tools serve different purposes, with Apktool focusing on APK reverse engineering and bytecode-viewer offering a more comprehensive suite for Java bytecode analysis. Apktool is generally simpler and faster for basic APK tasks, while bytecode-viewer provides a broader range of features for in-depth analysis of various Java-based file formats.
Android and Java bytecode viewer
Pros of ClassyShark
- User-friendly GUI for analyzing APK files and Android binaries
- Supports multiple file formats beyond just APKs (e.g., DEX, AAR, SO)
- Provides a comprehensive view of app architecture and dependencies
Cons of ClassyShark
- Less focused on APK modification and repackaging
- May not provide as detailed information about resources and assets
- Limited command-line interface compared to Apktool
Code Comparison
ClassyShark (Java):
public class ClassySharkAndroid extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Apktool (Java):
public class Main {
public static void main(String[] args) {
Options opts = new Options();
CommandLineParser parser = new DefaultParser();
CommandLine cmdLine = parser.parse(opts, args);
}
}
ClassyShark focuses on providing a user-friendly interface for analyzing Android apps and binaries, while Apktool specializes in reverse engineering APK files. ClassyShark offers a broader range of supported file formats and a more intuitive GUI, making it easier for developers to understand app architecture. However, Apktool excels in detailed APK manipulation and resource extraction, with a more robust command-line interface for advanced users.
An Open Source Java Decompiler Gui for Procyon
Pros of Luyten
- Specialized in Java decompilation, providing more accurate results for Java bytecode
- User-friendly GUI for easier navigation and analysis of decompiled code
- Supports multiple output formats, including Java source code and Procyon AST
Cons of Luyten
- Limited to Java decompilation, lacking support for other languages or file formats
- May struggle with heavily obfuscated code compared to Apktool's ability to handle various protection mechanisms
Code Comparison
Luyten (Java decompilation):
public class Example {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Apktool (Android resource extraction):
<resources>
<string name="app_name">Example App</string>
<string name="hello_world">Hello, World!</string>
</resources>
While Luyten focuses on decompiling Java bytecode to source code, Apktool excels at extracting and rebuilding Android APK resources. Apktool is more versatile for Android app analysis, handling various file formats and resource types. Luyten, on the other hand, provides a more specialized and user-friendly approach to Java decompilation, making it ideal for in-depth analysis of Java-based applications.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Apktool
This is the repository for Apktool. The website is on the Apktool docs branch.
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 it possible to debug smali code step-by-step. It also makes working with apps easier thanks to project-like file structure and automation of some repetitive tasks such as building apk, etc.
Apktool is NOT intended for piracy and other non-legal uses. It could be used for localizing and adding features, adding support for custom platforms, and other GOOD purposes. Just try to be fair with the authors of an app, that you use and probably like.
Support
Security Vulnerabilities
If you discover a security vulnerability within Apktool, please send an e-mail to Connor Tumbleson at connor.tumbleson(at)gmail.com. All security vulnerabilities will be promptly addressed.
Links
- Downloads
- Downloads Mirror
- How to Build
- Documentation
- Bug Reports
- Changelog/Information
- XDA Post
- Source (Github)
- Source (Bitbucket)
Sponsors
Special thanks goes to the following sponsors:
Sourcetoad
Sourcetoad is an award-winning software and app development firm committed to the co-creation of technology solutions that solve complex business problems, delight users, and help our clients achieve their goals.
Emerge Tools
Emerge Tools is a suite of revolutionary products designed to supercharge mobile apps and the teams that build them.
Top Related Projects
Dex to Java decompiler
Tools to work with android .dex and java .class files
smali/baksmali
A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
Android and Java bytecode viewer
An Open Source Java Decompiler Gui for Procyon
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot