slint-ui/slint · error
Dex conversion failed
Error message
Dex conversion failed
What it means
D8 ran but exited with a non-zero status during the .class -> .dex conversion; the build script prints D8's stderr under this message rather than panicking immediately. It means the Java class files produced by the earlier javac step could not be dexed — commonly bytecode level vs. D8 version mismatch, or (as the following JDK>=21 warning shows) a too-new JDK producing classes this D8 cannot process.
Solutions
- Read the D8 stderr printed with the panic for the real cause: most often multidex/MethodTooLarge issues or invalid class files
- Follow the built-in hint: the script checks the JDK version and warns when JDK >= 21 is used; downgrade to JDK 17 or a compatible toolchain if that warning appears
- Confirm android_min_api (20) and the single-dex assumption still hold; if the dex exceeds limits, raise min API or enable multidex
- Ensure all dependency jars (android.jar, d8 jar) match the build-tools version in use
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/backends/android-activity/build.rs:82 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/bf24a2ac5e53947b.
Report an issue: GitHub.
Appendix: source
Thrown at internal/backends/android-activity/build.rs:82
.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)