Convert Figma logo to code with AI

skylot logojadx

Dex to Java decompiler

40,878
4,805
40,878
397

Top Related Projects

6,287

smali/baksmali

12,202

Tools to work with android .dex and java .class files

A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)

13,917

A standalone Java Decompiler GUI

1,993

This is the public repository for the CFR Java decompiler

Unofficial mirror of FernFlower Java decompiler (All pulls should be submitted upstream)

Quick Overview

JADX (Java Decompiler X) is an open-source command-line and GUI tool for producing Java source code from Android Dex and APK files. It aims to provide high-quality decompilation of Android applications, making it easier for developers and security researchers to analyze and understand compiled Android code.

Pros

  • High-quality decompilation with improved readability compared to other tools
  • Supports both command-line and GUI interfaces for flexibility
  • Actively maintained with regular updates and bug fixes
  • Includes features like code search, navigation, and syntax highlighting

Cons

  • May struggle with heavily obfuscated code
  • Large or complex applications can take significant time to decompile
  • Occasional inaccuracies in decompiled code, especially for complex language features
  • Limited support for newer Java language features in some cases

Getting Started

To use JADX, follow these steps:

  1. Download the latest release from the GitHub repository.
  2. Extract the downloaded archive.
  3. Run the appropriate executable:
    • For GUI: bin/jadx-gui (Unix) or bin\jadx-gui.bat (Windows)
    • For CLI: bin/jadx (Unix) or bin\jadx.bat (Windows)

For CLI usage:

jadx [options] <input file> (.dex, .apk, .jar or .class)

For GUI usage, simply run the jadx-gui executable and open your desired file through the interface.

Common CLI options:

jadx -d <output dir> <input file>  # Specify output directory
jadx -j <threads count> <input file>  # Set number of threads for processing
jadx --show-bad-code <input file>  # Show inconsistent code (incorrectly decompiled)

For more detailed instructions and advanced usage, refer to the project's README and documentation on the GitHub repository.

Competitor Comparisons

6,287

smali/baksmali

Pros of smali

  • Focuses specifically on assembling and disassembling dex files
  • Provides a more low-level representation of Android bytecode
  • Offers a command-line interface for easier integration into scripts and tools

Cons of smali

  • Limited to working with dex files and Dalvik bytecode
  • Requires more knowledge of Android internals to use effectively
  • Lacks a graphical user interface for easier navigation and analysis

Code Comparison

smali:

.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

jadx:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

smali provides a lower-level representation of the bytecode, while jadx attempts to decompile the code back into Java, making it more readable for most developers. jadx offers a more comprehensive decompilation solution, including a GUI and support for various input formats, while smali focuses specifically on working with dex files at the assembly level.

12,202

Tools to work with android .dex and java .class files

Pros of dex2jar

  • Lightweight and focused on DEX to JAR conversion
  • Supports batch processing of multiple DEX files
  • Can be easily integrated into other tools and workflows

Cons of dex2jar

  • Limited functionality beyond DEX to JAR conversion
  • Less actively maintained compared to jadx
  • May produce less accurate decompiled code in some cases

Code Comparison

dex2jar:

d2j-dex2jar classes.dex -o output.jar

jadx:

jadx -d output_directory classes.dex

Key Differences

  • jadx provides a more comprehensive decompilation solution, including a GUI
  • dex2jar focuses on converting DEX to JAR, while jadx decompiles directly to Java source code
  • jadx offers more advanced features like code analysis and debugging support
  • dex2jar is more suitable for integration into custom toolchains
  • jadx generally produces more readable and accurate decompiled code

Both tools have their strengths and use cases. dex2jar is ideal for simple DEX to JAR conversion, while jadx is better suited for in-depth analysis and decompilation of Android applications. The choice between them depends on the specific requirements of the project and the level of detail needed in the decompiled output.

A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)

Pros of bytecode-viewer

  • More comprehensive decompilation options, including multiple decompilers
  • Supports a wider range of file formats, including APK, DEX, and JAR
  • Includes additional tools like a hex editor and search functionality

Cons of bytecode-viewer

  • Larger file size and potentially slower startup time
  • May have a steeper learning curve due to more complex interface
  • Less frequent updates compared to jadx

Code Comparison

bytecode-viewer:

public class BytecodeViewer {
    public static void main(String[] args) {
        // Initialize and launch the GUI
        SwingUtilities.invokeLater(() -> new MainViewerGUI().setVisible(true));
    }
}

jadx:

public class JadxCLI {
    public static void main(String[] args) {
        JadxCLIArgs jadxArgs = parse(args);
        int result = new JadxCLI(jadxArgs).execute();
        System.exit(result);
    }
}

Both projects aim to decompile and analyze Java bytecode, but they have different approaches. bytecode-viewer offers a more feature-rich GUI with multiple decompilation options, while jadx focuses on providing a streamlined and efficient decompilation process with both CLI and GUI interfaces. The code snippets show that bytecode-viewer is primarily GUI-based, while jadx supports both CLI and GUI operations.

13,917

A standalone Java Decompiler GUI

Pros of JD-GUI

  • User-friendly graphical interface for easy navigation
  • Supports viewing multiple files simultaneously in tabs
  • Integrates well with IDEs like Eclipse

Cons of JD-GUI

  • Less frequent updates and maintenance compared to JADX
  • Limited command-line functionality
  • May struggle with more complex obfuscated code

Code Comparison

JADX:

public class Example {
    public static void main(String[] args) {
        System.out.println("Hello, JADX!");
    }
}

JD-GUI:

public class Example {
  public static void main(String[] paramArrayOfString) {
    System.out.println("Hello, JD-GUI!");
  }
}

Both tools effectively decompile Java bytecode, but JADX often produces cleaner and more readable output. In this simple example, JADX preserves the original parameter name args, while JD-GUI uses a generic paramArrayOfString. For more complex code, JADX typically offers better handling of control structures and variable naming.

JADX is generally considered more powerful and actively maintained, with better support for Android APK decompilation. However, JD-GUI's graphical interface can be more intuitive for beginners or those who prefer a visual approach to code exploration.

1,993

This is the public repository for the CFR Java decompiler

Pros of CFR

  • More advanced decompilation techniques, often producing cleaner and more accurate Java code
  • Better handling of complex control flow structures and lambda expressions
  • Actively maintained with frequent updates and improvements

Cons of CFR

  • Slower decompilation speed compared to JADX, especially for large projects
  • Less user-friendly interface, primarily command-line based
  • Limited support for non-Java languages and formats

Code Comparison

JADX output:

public class Example {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

CFR output:

public class Example {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

In this simple example, both decompilers produce identical output. However, for more complex code structures, CFR often generates cleaner and more accurate representations of the original source code, especially when dealing with advanced Java features like lambdas and try-with-resources statements.

CFR excels in producing high-quality Java decompilations but lacks the broader language support and user-friendly interface of JADX. JADX, on the other hand, offers faster processing and a more accessible GUI, making it suitable for quick analysis and handling various file formats beyond Java.

Unofficial mirror of FernFlower Java decompiler (All pulls should be submitted upstream)

Pros of Fernflower

  • More mature and established project with a longer history
  • Generally produces more readable decompiled code
  • Better handling of complex control flow structures

Cons of Fernflower

  • Slower decompilation process compared to JADX
  • Less active development and community support
  • Limited GUI options for ease of use

Code Comparison

JADX output:

public class Example {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Fernflower output:

public class Example {
    public static void main(String[] var0) {
        System.out.println("Hello, World!");
    }
}

Both decompilers produce similar output for simple code structures. However, Fernflower tends to generate more accurate variable names and handle complex scenarios better, while JADX often produces more concise code.

JADX is generally faster and offers a user-friendly GUI, making it more accessible for quick analysis. Fernflower, on the other hand, excels in producing more accurate decompilations, especially for complex Java bytecode.

The choice between these tools depends on the specific use case, with JADX being preferred for rapid analysis and Fernflower for more in-depth decompilation needs.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

JADX

Build status GitHub contributors GitHub all releases GitHub release (latest by SemVer) Latest release Maven Central Java 11+ License

jadx - Dex to Java decompiler

Command line and GUI tools for producing Java source code from Android Dex and Apk files

[!WARNING] Please note that in most cases jadx can't decompile all 100% of the code, so errors will occur.
Check Troubleshooting guide for workarounds.

Main features:

  • decompile Dalvik bytecode to Java code from APK, dex, aar, aab and zip files
  • decode AndroidManifest.xml and other resources from resources.arsc
  • deobfuscator included

jadx-gui features:

  • view decompiled code with highlighted syntax
  • jump to declaration
  • find usage
  • full text search
  • smali debugger, check wiki page for setup and usage

Jadx-gui key bindings can be found here

See these features in action here: jadx-gui features overview

Download

After download unpack zip file go to bin directory and run:

  • jadx - command line version
  • jadx-gui - UI version

On Windows run .bat files with double-click
Note: ensure you have installed Java 11 or later 64-bit version. For Windows, you can download it from oracle.com (select x64 Installer).

Install

  • Arch Linux Arch Linux package AUR Version
    sudo pacman -S jadx
    
  • macOS homebrew version
    brew install jadx
    
  • Flathub Flathub Version
    flatpak install flathub com.github.skylot.jadx
    

Use jadx as a library

You can use jadx in your java projects, check details on wiki page

Build from source

JDK 11 or higher must be installed:

git clone https://github.com/skylot/jadx.git
cd jadx
./gradlew dist

(on Windows, use gradlew.bat instead of ./gradlew)

Scripts for run jadx will be placed in build/jadx/bin and also packed to build/jadx-<version>.zip

Usage

jadx[-gui] [command] [options] <input files> (.apk, .dex, .jar, .class, .smali, .zip, .aar, .arsc, .aab, .xapk, .jadx.kts)
commands (use '<command> --help' for command options):
  plugins	  - manage jadx plugins

options:
  -d, --output-dir                    - output directory
  -ds, --output-dir-src               - output directory for sources
  -dr, --output-dir-res               - output directory for resources
  -r, --no-res                        - do not decode resources
  -s, --no-src                        - do not decompile source code
  --single-class                      - decompile a single class, full name, raw or alias
  --single-class-output               - file or dir for write if decompile a single class
  --output-format                     - can be 'java' or 'json', default: java
  -e, --export-gradle                 - save as android gradle project
  -j, --threads-count                 - processing threads count, default: 4
  -m, --decompilation-mode            - code output mode:
                                         'auto' - trying best options (default)
                                         'restructure' - restore code structure (normal java code)
                                         'simple' - simplified instructions (linear, with goto's)
                                         'fallback' - raw instructions without modifications
  --show-bad-code                     - show inconsistent code (incorrectly decompiled)
  --no-xml-pretty-print               - do not prettify XML
  --no-imports                        - disable use of imports, always write entire package name
  --no-debug-info                     - disable debug info parsing and processing
  --add-debug-lines                   - add comments with debug line numbers if available
  --no-inline-anonymous               - disable anonymous classes inline
  --no-inline-methods                 - disable methods inline
  --no-move-inner-classes             - disable move inner classes into parent
  --no-inline-kotlin-lambda           - disable inline for Kotlin lambdas
  --no-finally                        - don't extract finally block
  --no-replace-consts                 - don't replace constant value with matching constant field
  --escape-unicode                    - escape non latin characters in strings (with \u)
  --respect-bytecode-access-modifiers - don't change original access modifiers
  --mappings-path                     - deobfuscation mappings file or directory. Allowed formats: Tiny and Tiny v2 (both '.tiny'), Enigma (.mapping) or Enigma directory
  --mappings-mode                     - set mode for handling the deobfuscation mapping file:
                                         'read' - just read, user can always save manually (default)
                                         'read-and-autosave-every-change' - read and autosave after every change
                                         'read-and-autosave-before-closing' - read and autosave before exiting the app or closing the project
                                         'ignore' - don't read or save (can be used to skip loading mapping files referenced in the project file)
  --deobf                             - activate deobfuscation
  --deobf-min                         - min length of name, renamed if shorter, default: 3
  --deobf-max                         - max length of name, renamed if longer, default: 64
  --deobf-whitelist                   - space separated list of classes (full name) and packages (ends with '.*') to exclude from deobfuscation, default: android.support.v4.* android.support.v7.* android.support.v4.os.* android.support.annotation.Px androidx.core.os.* androidx.annotation.Px
  --deobf-cfg-file                    - deobfuscation mappings file used for JADX auto-generated names (in the JOBF file format), default: same dir and name as input file with '.jobf' extension
  --deobf-cfg-file-mode               - set mode for handling the JADX auto-generated names' deobfuscation map file:
                                         'read' - read if found, don't save (default)
                                         'read-or-save' - read if found, save otherwise (don't overwrite)
                                         'overwrite' - don't read, always save
                                         'ignore' - don't read and don't save
  --deobf-use-sourcename              - use source file name as class name alias
  --deobf-res-name-source             - better name source for resources:
                                         'auto' - automatically select best name (default)
                                         'resources' - use resources names
                                         'code' - use R class fields names
  --use-kotlin-methods-for-var-names  - use kotlin intrinsic methods to rename variables, values: disable, apply, apply-and-hide, default: apply
  --rename-flags                      - fix options (comma-separated list of):
                                         'case' - fix case sensitivity issues (according to --fs-case-sensitive option),
                                         'valid' - rename java identifiers to make them valid,
                                         'printable' - remove non-printable chars from identifiers,
                                        or single 'none' - to disable all renames
                                        or single 'all' - to enable all (default)
  --integer-format                    - how integers are displayed:
                                         'auto' - automatically select (default)
                                         'decimal' - use decimal
                                         'hexadecimal' - use hexadecimal
  --fs-case-sensitive                 - treat filesystem as case sensitive, false by default
  --cfg                               - save methods control flow graph to dot file
  --raw-cfg                           - save methods control flow graph (use raw instructions)
  -f, --fallback                      - set '--decompilation-mode' to 'fallback' (deprecated)
  --use-dx                            - use dx/d8 to convert java bytecode
  --comments-level                    - set code comments level, values: error, warn, info, debug, user-only, none, default: info
  --log-level                         - set log level, values: quiet, progress, error, warn, info, debug, default: progress
  -v, --verbose                       - verbose output (set --log-level to DEBUG)
  -q, --quiet                         - turn off output (set --log-level to QUIET)
  --version                           - print jadx version
  -h, --help                          - print this help

Plugin options (-P<name>=<value>):
 1) dex-input: Load .dex and .apk files
    - dex-input.verify-checksum       - verify dex file checksum before load, values: [yes, no], default: yes
 2) java-convert: Convert .class, .jar and .aar files to dex
    - java-convert.mode               - convert mode, values: [dx, d8, both], default: both
    - java-convert.d8-desugar         - use desugar in d8, values: [yes, no], default: no
 3) kotlin-metadata: Use kotlin.Metadata annotation for code generation
    - kotlin-metadata.class-alias     - rename class alias, values: [yes, no], default: yes
    - kotlin-metadata.method-args     - rename function arguments, values: [yes, no], default: yes
    - kotlin-metadata.fields          - rename fields, values: [yes, no], default: yes
    - kotlin-metadata.companion       - rename companion object, values: [yes, no], default: yes
    - kotlin-metadata.data-class      - add data class modifier, values: [yes, no], default: yes
    - kotlin-metadata.to-string       - rename fields using toString, values: [yes, no], default: yes
    - kotlin-metadata.getters         - rename simple getters to field names, values: [yes, no], default: yes
 4) rename-mappings: various mappings support
    - rename-mappings.format          - mapping format, values: [AUTO, TINY_FILE, TINY_2_FILE, ENIGMA_FILE, ENIGMA_DIR, SRG_FILE, XSRG_FILE, CSRG_FILE, TSRG_FILE, TSRG_2_FILE, PROGUARD_FILE], default: AUTO
    - rename-mappings.invert          - invert mapping on load, values: [yes, no], default: no

Environment variables:
  JADX_DISABLE_XML_SECURITY - set to 'true' to disable all security checks for XML files
  JADX_DISABLE_ZIP_SECURITY - set to 'true' to disable all security checks for zip files
  JADX_ZIP_MAX_ENTRIES_COUNT - maximum allowed number of entries in zip files (default: 100 000)
  JADX_CONFIG_DIR - custom config directory, using system by default
  JADX_CACHE_DIR - custom cache directory, using system by default
  JADX_TMP_DIR - custom temp directory, using system by default

Examples:
  jadx -d out classes.dex
  jadx --rename-flags "none" classes.dex
  jadx --rename-flags "valid, printable" classes.dex
  jadx --log-level ERROR app.apk
  jadx -Pdex-input.verify-checksum=no app.apk

These options also work in jadx-gui running from command line and override options from preferences' dialog

Troubleshooting

Please check wiki page Troubleshooting Q&A

Contributing

To support this project you can:

  • Post thoughts about new features/optimizations that important to you
  • Submit decompilation issues, please read before proceed: Open issue
  • Open pull request, please follow these rules: Pull Request Process

Licensed under the Apache 2.0 License