pxb1988/dex2jar · error · RuntimeException

File

Error message

File 

What it means

Input validation in GenerateCompileStubFromOdex.doCommandLine: one of the positional argument files exists but could not be read (or does not exist) when Files.readAllBytes was called on it — the exception message is prefixed with 'File ' followed by the offending path. It fires before the odex magic-number check, so the file was never even parsed.

Solutions

  1. Check the printed file path for typos and confirm the file exists at that location
  2. Verify read permissions on the file and that it is not a directory
  3. Ensure the argument is a local filesystem path, not a pattern or URL
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dex-tools/src/main/java/com/googlecode/dex2jar/tools/GenerateCompileStubFromOdex.java:57 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/629886afebff5bd9. Report an issue: GitHub.

Appendix: source

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

        }

        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);
                } else if (magic == MAGIC_DEX) {
                    doDex(bs, out);
                } else {
                    throw new RuntimeException("File " + x + " is not an dex or odex");
                }

            }
        }
    }

    private void doDex(ByteBuffer bs, final Path out) {
        DexFileReader reader = new DexFileReader(bs);
        DexFileNode fileNode = new DexFileNode();
        reader.accept(fileNode, DexFileReader.SKIP_CODE);
        Dex2Asm dex2Asm = new Dex2Asm();
        dex2Asm.convertDex(fileNode, new ClassVisitorFactory() {
            @Override
            public ClassVisitor create(final String classInternalName) {
                final Path target = out.resolve(classInternalName + ".class");
                if (Files.exists(target)) {
                    System.err.println("Class " + classInternalName + " already exists, skipping.");
                    return null;

View on GitHub (pinned to b5bda4fb49)