slint-ui/slint · error

Could not generate the D8 command: {e}

Error message

Could not generate the D8 command: {e}

What it means

Error "Could not generate the D8 command: {e}" thrown in slint-ui/slint.

Source

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

        .unwrap_or_else(|e| panic!("Could not generate the java compiler command: {e}"))
        .args(["-encoding", "UTF-8"])
        .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 3fd8f2ec03)

Solutions

  1. Install the Android SDK build-tools containing d8 and set ANDROID_HOME.
  2. Check that the d8 path detected by the build script exists.

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/ba695a075e2efa5d. Report an issue: GitHub.