Convert Figma logo to code with AI

pxb1988 logodex2jar

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

12,282
2,104
12,282
379

Top Related Projects

6,309

smali/baksmali

41,326

Dex to Java decompiler

Virtual Engine for Android(Support 14.0 in business version)

BlackDex is an Android unpack(dexdump) tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phone or emulator, you can unpack APK File in several seconds.

20,044

A tool for reverse engineering Android apk files

Quick Overview

dex2jar is a tool for converting Android's .dex format to Java's .class format. It allows developers to decompile Android applications, examine their bytecode, and potentially modify or analyze the code. This tool is particularly useful for reverse engineering Android apps and understanding their inner workings.

Pros

  • Enables easy conversion of Android DEX files to Java JAR files
  • Supports both DEX and ODEX formats
  • Provides a command-line interface for easy integration into scripts and workflows
  • Actively maintained with regular updates and bug fixes

Cons

  • May not always produce perfect Java code, especially for complex or obfuscated apps
  • Requires some technical knowledge to use effectively
  • Could potentially be used for malicious purposes if misused
  • May not work correctly with heavily protected or anti-decompilation apps

Code Examples

Since dex2jar is primarily a command-line tool rather than a code library, there are no code examples in the traditional sense. However, here are some example command-line usage scenarios:

# Convert a single DEX file to JAR
d2j-dex2jar classes.dex

# Convert multiple DEX files to JAR
d2j-dex2jar classes.dex classes2.dex

# Convert an APK file to JAR
d2j-dex2jar myapp.apk

Getting Started

To get started with dex2jar:

  1. Download the latest release from the GitHub repository.
  2. Extract the downloaded archive to a directory of your choice.
  3. Add the dex2jar-<version> directory to your system's PATH.
  4. Open a terminal and run the following command to verify the installation:
d2j-dex2jar --help
  1. To convert a DEX file to JAR, use the following command:
d2j-dex2jar path/to/your/classes.dex

The converted JAR file will be created in the same directory as the input DEX file.

Competitor Comparisons

6,309

smali/baksmali

Pros of smali

  • More comprehensive disassembly and assembly of DEX files
  • Better support for Android-specific features and bytecode
  • Actively maintained with regular updates

Cons of smali

  • Steeper learning curve for beginners
  • Limited to DEX files, while dex2jar can convert to JAR

Code Comparison

smali:

.class public LHelloWorld;
.super Ljava/lang/Object;
.method public static main([Ljava/lang/String;)V
    .registers 2
    sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
    const-string v1, "Hello, World!"
    invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
    return-void
.end method

dex2jar (decompiled Java):

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

smali provides a lower-level representation of Android bytecode, offering more control and insight into the DEX file structure. dex2jar, on the other hand, aims to convert DEX to JAR, making it easier to work with Java decompilers but potentially losing some Android-specific information in the process.

41,326

Dex to Java decompiler

Pros of jadx

  • More comprehensive decompilation toolset, including a GUI and command-line interface
  • Actively maintained with regular updates and improvements
  • Better handling of complex Java constructs and Android-specific code

Cons of jadx

  • May be slower for large-scale batch processing compared to dex2jar
  • Potentially higher resource usage due to more advanced decompilation features

Code comparison

jadx:

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

dex2jar:

public class MainActivity extends Activity {
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2130903040);
    }
}

Key differences

  • jadx produces more readable and complete Java code
  • dex2jar output may require additional processing to achieve similar readability
  • jadx preserves resource references (R.layout.activity_main), while dex2jar uses numeric constants

Both tools serve the purpose of decompiling Android DEX files, but jadx offers a more polished and feature-rich experience, especially for manual analysis and reverse engineering tasks. dex2jar, being more lightweight, may be preferred for specific use cases or integration into other toolchains.

Virtual Engine for Android(Support 14.0 in business version)

Pros of VirtualApp

  • Provides a complete virtual environment for running Android apps
  • Supports multi-app management and isolation
  • Offers more advanced features like app cloning and parallel running

Cons of VirtualApp

  • More complex to set up and use compared to dex2jar
  • Requires deeper understanding of Android internals
  • May have compatibility issues with certain Android versions or devices

Code Comparison

VirtualApp (Java):

@Override
public void onCreate() {
    super.onCreate();
    VirtualCore.get().setComponentDelegate(new MyComponentDelegate());
    VirtualCore.get().initialize(new VirtualCore.BuildConfig(BuildConfig.USE_OUTSIDE_APK));
}

dex2jar (Java):

public static void main(String[] args) throws IOException {
    Dex2jar.from(args[0]).to(args[1]).translate();
}

VirtualApp focuses on creating a virtual environment for running Android apps, offering more advanced features but with increased complexity. dex2jar, on the other hand, is a simpler tool specifically designed for converting DEX files to JAR format, making it easier to use for basic reverse engineering tasks but with limited functionality compared to VirtualApp.

BlackDex is an Android unpack(dexdump) tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phone or emulator, you can unpack APK File in several seconds.

Pros of BlackDex

  • More recent and actively maintained project
  • Provides a user-friendly GUI interface for easier operation
  • Supports batch processing of multiple APK files

Cons of BlackDex

  • Limited to Android platform and APK files
  • May have a steeper learning curve for users unfamiliar with GUI tools
  • Potentially slower processing speed compared to command-line tools

Code Comparison

BlackDex (Java):

public class BlackDex extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        CrashReport.initCrashReport(getApplicationContext(), "YOUR_APP_ID", false);
    }
}

dex2jar (Java):

public class Dex2jar {
    public static void main(String[] args) throws IOException {
        com.googlecode.dex2jar.tools.Dex2jarCmd.main(args);
    }
}

Summary

BlackDex offers a more user-friendly approach with its GUI and batch processing capabilities, making it suitable for those who prefer visual interfaces. However, it's limited to Android APK files and may be slower than command-line alternatives. dex2jar, while older, provides a lightweight command-line tool that can be more versatile and potentially faster for experienced users. The choice between the two depends on the user's specific needs and familiarity with different interfaces.

20,044

A tool for reverse engineering Android apk files

Pros of Apktool

  • More comprehensive APK handling: Apktool can decode resources, modify them, and rebuild APKs
  • Better maintained and actively developed
  • Supports newer Android features and file formats

Cons of Apktool

  • Slower processing time for large APKs
  • More complex to use for simple decompilation tasks
  • Requires additional tools for Java source code generation

Code Comparison

Apktool (decoding an APK):

apktool d path/to/file.apk

dex2jar (converting DEX to JAR):

d2j-dex2jar.sh path/to/classes.dex

Apktool focuses on full APK manipulation, while dex2jar specializes in converting DEX files to JAR format. Apktool is more versatile for Android app analysis and modification, but dex2jar is simpler and faster for quick DEX to Java bytecode conversion.

Both tools serve different purposes in the Android reverse engineering ecosystem. Apktool is better suited for comprehensive app analysis and modification, while dex2jar excels at quick DEX to JAR conversions for further analysis with Java decompilers.

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

dex2jar

Project move to GitHub

_MirrorWikiDownloadsIssues
ghhttps://github.com/pxb1988/dex2jarWikiReleasesIssues
sfhttps://sourceforge.net/p/dex2jaroldoldold
bbhttps://bitbucket.org/pxb1988/dex2jaroldoldold
gchttps://code.google.com/p/dex2jaroldoldold

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

  1. dex-reader/writer: Read/write the Dalvik Executable (.dex) file. It has a light weight API similar with ASM.
  2. d2j-dex2jar: Convert .dex file to .class files (zipped as jar)
  3. smali/baksmali: disassemble dex to smali files and assemble dex from smali files. different implementation to smali/baksmali, same syntax, but we support escape in type desc "Lcom/dex2jar\t\u1234;"
  4. other tools: d2j-decrypt-string

Usage

  1. In the root directory run: ./gradlew distZip
  2. cd dex-tools/build/distributions
  3. Unzip the file dex-tools-2.1-SNAPSHOT.zip (file size should be ~5 MB)
  4. Run d2j-dex2jar.sh from the unzipped directory

Example usage:

sh d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk

And the output file will be apk_to_decompile-dex2jar.jar.

Need help ?

post on issue trackers list above.

License

Apache 2.0