Utilities

Compile a class-file JAR to one DEX

Compile supplied Java class files into one binary DEX artifact.

Agent

overview

What d8-compile-dex does

Supply one local class-file JAR. The adapter validates it and stages the bytes under a .jar filename before running pinned R8 D8 9.5.26 in release mode with minimum API 28 and desugaring disabled. It saves generated classes.dex as the output FILE.

This node does not expose android.jar, a library resolver or caller-selected compiler options. It does not package an APK, sign an app or run bytecode on a device. A successful compile alone does not establish runtime compatibility.

The supplied JAR must be a nonempty regular file of at most 20 MiB, with at most 5,000 ZIP entries, at most 20 MiB declared size per entry and at most 64 MiB declared total expansion. The native Java process has a 90-second timeout and a 256 MiB maximum Java heap. Native logs and the one DEX artifact are checked against 4 MiB after the process exits; these are not peak process-memory or disk containment guarantees.

source hub.docker.com/r/nenadzaric/skills-android-d8-compile-dex

use cases

Where d8-compile-dex fits

Produce DEX from a supplied class-file fixture

Compile existing JVM class files to a DEX artifact for downstream inspection. The owned fixture produces a DEX whose answer() method returns 42 under independent baksmali inspection.

Keep compilation separate from app packaging

Pass the binary DEX output to a compatible downstream node. APK construction, resource processing, signing and device execution are separate jobs.

Reject an archive without class files

The adapter checks for a .class entry before invoking D8. The native no-class probe exits zero without a DEX; adapter preflight rejects that input instead of treating missing output as a successful artifact.

reference

d8-compile-dex inputs and flags

1 inputs
NameTypeFlagDescription
jarFILE--jarLocal class-file JAR, nonempty and at most 20 MiB; contains at least one .class entry.

Showing key inputs. d8-compile-dex exposes 1 inputs in total.

example

Run d8-compile-dex

d8-compile-dex · command
d8-compile-dex --jar owned-answer42.jar -o classes.dex
sample output
.method public static answer()I
    .registers 1

    const/16 v0, 0x2a

    return v0
.end method

guidance

Choosing d8-compile-dex

Choose this node when your input is a class-file JAR and your next step needs a single DEX. Choose smali-assemble for smali source or dex2jar-convert for the opposite DEX-to-JAR direction. These jobs are not a guarantee of lossless round trips.

smali-assemble

Assemble a smali source folder into DEX rather than compile JVM class files from a JAR.

dex2jar-convert

Convert DEX to a JVM JAR. D8 here accepts class-file JAR input and produces DEX.

faq

d8-compile-dex questions

No. This contract fixes minimum API 28, release mode and --no-desugaring. It exposes only the supplied JAR FILE and output FILE path.

No. The output is one binary DEX file. APK/AAB packaging, android.jar and library resolution, signing, resource processing and device execution are not exposed.

The adapter rejects it during preflight. The pinned native no-class probe exits zero but produces no artifact; that native behavior is not labeled a native failure. Malformed class data produced a native nonzero exit and adapter exit 2 in the saved tests.

The supplied JAR must be a nonempty regular file of at most 20 MiB, with at most 5,000 ZIP entries, at most 20 MiB declared size per entry and at most 64 MiB declared total expansion. The native Java process has a 90-second timeout and a 256 MiB maximum Java heap. Native logs and the one DEX artifact are checked against 4 MiB after the process exits; these are not peak process-memory or disk containment guarantees. Unsupported member paths, duplicates, symlinks and encrypted ZIP entries are rejected. Output must be absent or an empty regular file and must differ from the input. More than one generated DEX is rejected.

The corrected filenamefix1 image passed nine native cases, including a worker-style output.txt input path, positive compilation and the existing negative/output-preservation cases. Its three-node platform workflow also passed with downloaded JAR, DEX and verifier checks. The 692-byte DEX matches the independently baksmali-inspected fixture whose answer() returns 42. Public image and source/notices downloads have been verified anonymously. The original tool ID is public in the Library.

The source link gives immutable ORAS retrieval directions and the bundle SHA-256 for the actual corrected adapter, build files, fixtures, R8 source, original component notices and matching Java runtime source. R8 9.5.26 is pinned to source commit e3b702721f5dfe78fc536316df4741ff6f32916a, with BSD-3-Clause core and component terms. Release dependency records include build dependencies and are not an exhaustive inventory of the minimized runtime.

Run d8-compile-dex yourself

Saved independent baksmali inspection excerpt from the DEX also downloaded and verified in the owned platform run. The delivered artifact is binary DEX, not this smali text. Its native SHA-256 is 6f56c40237b9185b946878d5d16d8a202041c6627a0c66cce0a87e7a373b8ee7.

Facts on this page come from the live Trickest tool library.