slint-ui/slint · error

Error running D8

Error message

Error running D8: {e}

What it means

After constructing the D8 command, the build script runs it; this panic fires when the process itself could not be spawned (as opposed to D8 exiting with an error status, which is handled separately as 'Dex conversion failed'). Typical causes: a missing java executable/JAVA_HOME misconfiguration, insufficient permissions, or the jar path disappearing between construction and execution.

Solutions

  1. Check that the java executable from java_home is on PATH and runnable; {e} is the io::Error from spawning D8 (usually the java binary)
  2. Verify JAVA_HOME points to a JDK (not a JRE) and that the D8 wrapper command constructed by Dexer is valid
  3. Increase verbosity of the Dexer command construction and run the emitted command manually to see the failure
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/backends/android-activity/build.rs:69 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/7b06a11d03898806. Report an issue: GitHub.

Appendix: source

Thrown at internal/backends/android-activity/build.rs:69

        .output()
        .unwrap_or_else(|e| panic!("Could not run the java compiler: {e}"));

    if !o.status.success() {
        panic!("Java compilation failed: {}", String::from_utf8_lossy(&o.stderr));
    }

    let o = Dexer::new()
        .android_jar(&android_jar)
        .class_path(&out_class_dir)
        .collect_classes(&out_class_dir)
        .unwrap()
        .release(release_mode)
        .android_min_api(20) // disable multidex for single dex file output
        .out_dir(out_dir)
        .command()
        .unwrap_or_else(|e| panic!("Could not generate the D8 command: {e}"))
        .output()
        .unwrap_or_else(|e| panic!("Error running D8: {e}"));

    if !o.status.success() {
        eprintln!("Dex conversion failed: {}", String::from_utf8_lossy(&o.stderr));
        let java_home = android_build::java_home().unwrap();
        let java_ver = android_build::check_javac_version(&java_home).unwrap();
        if java_ver >= 21 {
            eprintln!("WARNING: JDK version 21 is known to cause an error with older android SDK");
            eprintln!("See https://github.com/slint-ui/slint/issues/4973");
            eprintln!(
                "Try downgrading your version of Java to something like JDK 17, or upgrade to the SDK build tools 35"
            );
        }
        panic!("Dex conversion failed");
    }

    println!("cargo:rerun-if-changed={java_src_path}");
}

View on GitHub (pinned to bb937076de)