Open HookedBehemoth opened 7 months ago
Using jdk 17 makes it work with the slint master branch. From the repository I get a different error about the copyright sign not being ASCII.
error: failed to run custom build command for `i-slint-backend-android-activity v1.5.1`
Caused by:
process didn't exit successfully: `/home/behemoth/source/timetracker/target/debug/build/i-slint-backend-android-activity-2b756c32d0ff7e66/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=ANDROID_HOME
cargo:rerun-if-env-changed=JAVA_HOME
--- stderr
thread 'main' panicked at /home/behemoth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-backend-android-activity-1.5.1/build.rs:59:9:
Java compilation failed: java/SlintAndroidJavaHelper.java:1: error: unmappable character (0xC2) for encoding US-ASCII
// Copyright ?? SixtyFPS GmbH <info@slint.dev>
^
java/SlintAndroidJavaHelper.java:1: error: unmappable character (0xA9) for encoding US-ASCII
// Copyright ?? SixtyFPS GmbH <info@slint.dev>
Thanks for reporting an issue.
The ASCII thing was fixed in https://github.com/slint-ui/slint/commit/2b7834e7c9ba41cf9ddac8b26ab08d631dfdcaa2
Regarding the first issue, it looks like the d8 script, which is part of the android sdk fails for some reason. But i'm not really understanding why. You're saying that downgrading Java SDK helps? Maybe there is an incompatibility with D8 and the new JDK? Or perhpas Slint's build script is not invoking the d8 script properly?
(Was also reported in #5029 with similar error:
Dex conversion failed: Error in /home/bronson/Projects/bike-aid/bike-aid-app/target/aarch64-linux-android/debug/build/i-slint-backend-android-activity-5584ba82a1156d20/out/java/dev/slint/android-activity/SlintInputView$1.class:
java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null
Compilation failed with an internal error.
Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /home/bronson/Projects/bike-aid/bike-aid-app/target/aarch64-linux-android/debug/build/i-slint-backend-android-activity-5584ba82a1156d20/out/java/dev/slint/android-activity/SlintInputView$1.class
...
Looks like there is some incompatibility with the android SDK and the java JDK 21. Googling this error show other result, but none of these link have any solutions:
I'm not sure what we should do here. Maybe we can find out what version of the android SDK and JDK are incompatibles and detect that in the build script. Or perhaps there is a better way to invoke D8 that doesn't have this error.
For now, the issue is being "worked around" by printing a message in the debug telling to downgrade Java.
Tried it on Windows and Linux, with x86_64- and aarch64-linux-android, slint 1.5.0, 1.5.1 and master. Generating the example apk from cargo-apk works fine.
The generated error is in the detail tag below.
environment
SDK: Tried 30 and 34 via
NDK: 26.2.11394342
reproduction
cargo apk run -p todo --target x86_64-linux-android --lib
I'd love for this feature to work. Is there any more information I can provide to help you reproduce this?