slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.76k stars 550 forks source link

Dex conversion failed: Error: Could not create the Java Virtual Machine #4920

Open miaomiao1992 opened 5 months ago

miaomiao1992 commented 5 months ago

D:\codebase\slint-android-demo>cargo apk run --target aarch64-linux-android --lib Using package slint-android-demo in D:\codebase\slint-android-demo\Cargo.toml Compiling i-slint-backend-android-activity v1.5.1 Compiling i-slint-renderer-skia v1.5.1 error: failed to run custom build command for i-slint-backend-android-activity v1.5.1

Caused by: process didn't exit successfully: D:/rust-target\debug\build\i-slint-backend-android-activity-c5b233ffd7d690ce\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=ANDROID_HOME cargo:rerun-if-env-changed=JAVA_HOME

--- stderr thread 'main' panicked at C:\Users\Administrator.cargo\registry\src\mirrors.ustc.edu.cn-12df342d903acd47\i-slint-backend-android-activity-1.5.1\build.rs:87:9: Dex conversion failed: Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

note: run with RUST_BACKTRACE=1 environment variable to display a backtrace Error: Command cargo build --lib --target aarch64-linux-android had a non-zero exit code.

D:\codebase\slint-android-demo>java -version java version "11.0.21" 2023-10-17 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.21+9-LTS-193) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.21+9-LTS-193, mixed mode)

ogoffart commented 5 months ago

Thanks for filling a bug.

This means that the d8 tool didn't run correctly. I have no idea why this is the case though.

kitsuniru commented 4 months ago

Same problem, same (older patch) java version

java version "11.0.19" 2023-04-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.19+9-LTS-224)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.19+9-LTS-224, mixed mode)
iAndyHD3 commented 3 months ago

In my case, this is a problem with the d8 tool itself, up on running ./d8 it outupts

-Djava.ext.dirs=C:\Users\...\android-sdk-33\build-tools\33.0.2\lib is not supported.  Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

And this fix worked fine for me, it's not ideal since you need to edit d8.bat but it does fix the issue