pxb1988/dex2jar · error · HelpException

No odex

Error message

No odex

What it means

Usage guard in GenerateCompileStubFromOdex.doCommandLine: no positional odex file was provided. The command's syntax is '[options] <odex0> [odex1 ... odexN]', so with an empty remainingArgs list it aborts with this HelpException and prints help.

Solutions

  1. Re-run d2j-generate-stub-from-odex with at least one .odex file path as a positional argument
  2. Use -h to review the accepted options (e.g. -o for the output jar) and the expected file format
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dex-tools/src/main/java/com/googlecode/dex2jar/tools/GenerateCompileStubFromOdex.java:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/421a3e6ccee98b6a. Report an issue: GitHub.

Appendix: source

Thrown at dex-tools/src/main/java/com/googlecode/dex2jar/tools/GenerateCompileStubFromOdex.java:35

@BaseCmd.Syntax(cmd = "d2j-generate-stub-from-odex", syntax = "[options] <odex0> [odex1 ... odexN]", desc =
        "Generate no-code jar from odex")
public class GenerateCompileStubFromOdex extends BaseCmd {
    private static final int MAGIC_ODEX = 0x0A796564 & 0x00FFFFFF;// hex for 'dey ', ignore the 0A
    private static final int MAGIC_DEX = 0x0A786564 & 0x00FFFFFF;// hex for 'dex ', ignore the 0A

    public static void main(String... args) {
        new GenerateCompileStubFromOdex().doMain(args);
    }

    @Opt(opt = "o", longOpt = "output", description = "output .jar file, default is stub.jar", argName = "out-jar-file")
    private Path output;
    @Opt(opt = "npri", longOpt = "no-private", description = "", hasArg = false)
    private boolean noPrivate;

    @Override
    protected void doCommandLine() throws Exception {
        if (remainingArgs.length == 0) {
            throw new HelpException("No odex");
        }
        if (output == null) {
            output = new File("stub.jar").toPath();
        }

        try (FileSystem fs = createZip(output)) {
            Path out = fs.getPath("/");
            for (String x : remainingArgs) {
                System.err.println("Processing " + x + " ...");
                ByteBuffer bs = ByteBuffer.wrap(Files.readAllBytes(new File(x).toPath()))
                        .order(ByteOrder.LITTLE_ENDIAN);
                int magic = bs.getInt(0) & 0x00FFFFFF;
                if (magic == MAGIC_ODEX) {
                    int offset = bs.getInt(8);
                    int length = bs.getInt(12);
                    bs.position(offset);
                    ByteBuffer n = (ByteBuffer) bs.slice().limit(length);
                    doDex(n, out);

View on GitHub (pinned to b5bda4fb49)