-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Build with JDK21 fails with java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null
#4973
Comments
This comment was marked as resolved.
This comment was marked as resolved.
Thanks for reporting an issue. The ASCII thing was fixed in 2b7834e 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. |
(Was also reported in #5029 with similar error:
Looks like there is some incompatibility with the android SDK and the java JDK 21.
I'm not sure what we should do here. |
java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null
… JDK 21 It doesn't compile: ``` Dex conversion failed: Error in ...\out\java\dev\slint\android-activity\SlintAndroidJavaHelper$1.class: java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null ``` I don't know how to solve the error, but i can giv an informative message telling them to downgrade Java CC: #4973
… JDK 21 It doesn't compile: ``` Dex conversion failed: Error in ...\out\java\dev\slint\android-activity\SlintAndroidJavaHelper$1.class: java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null ``` I don't know how to solve the error, but i can giv an informative message telling them to downgrade Java CC: #4973
For now, the issue is being "worked around" by printing a message in the debug telling to downgrade Java. |
This build script works with JDK 21: https://docs.rs/crate/jni-min-helper/latest/source/build.rs. |
I was wrong, the problem is probably not about the build script (how D8 is invoked). Adding this non-static method in any Java class used in
This produces a anonymous class which is compiled into a Comparing them by I guess that Java 21 isn't well supported by Android at the moment (not sure): https://developer.android.com/build/jdks. |
I've tested Android build tools 34.0.0 and 35.0.0 with platform 30 under JDK 21, the D8 from version 35.0.0 built the dex file successfully. With build tools 34.0.0, the result is the same as build tools 33.0.2. This issue and #6695 may be closed. |
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?
The text was updated successfully, but these errors were encountered: