Skip to content
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

Fix examples for JDK 21 (Android Studio Ladybug) #695

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

greenrobot-team
Copy link
Member

Public PR to run GitHub Actions.

@greenrobot-team greenrobot-team force-pushed the 127-fix-examples-android-studio-ladybug branch 2 times, most recently from ce7524d to f29e1ac Compare December 2, 2024 12:19
At least Flutter SDK 3.7.12: This matches what can be built by CI due to
dependency constraints, so is the lowest version users could possibly be
using.

At least Flutter SDK 3.13.9: required to upgrade to Android Gradle
Plugin 8.2.1 (to support JDK 21) which requires using the namespace
property.

At least Flutter SDK 3.16.9: required to apply Flutter plugin using
plugins block, which is required to do further changes to support
JDK 21.
…ox-dart#127

To match the lowest supported version by examples.
@greenrobot-team greenrobot-team force-pushed the 127-fix-examples-android-studio-ladybug branch from b5a33c5 to a467973 Compare December 2, 2024 13:58
@greenrobot-team greenrobot-team force-pushed the 127-fix-examples-android-studio-ladybug branch from 2f03936 to 2dd62a3 Compare December 3, 2024 07:27
@greenrobot-team greenrobot-team force-pushed the 127-fix-examples-android-studio-ladybug branch from 2dd62a3 to ecb998c Compare December 3, 2024 07:29
@hagerf
Copy link

hagerf commented Jan 12, 2025

Would this PR make the warnings below that objectbox currently give me disappear?
warning: [options] source value 8 is obsolete and will be removed in a future release warning: [options] target value 8 is obsolete and will be removed in a future release warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.

@greenrobot-team
Copy link
Member Author

greenrobot-team commented Jan 13, 2025

@hagerf No, it won't. Thanks for reporting!

This warning occurs due to using JDK 21 to compile.

But we can make changes to the Flutter plugins to suppress it, made an internal note about that (objectbox-dart#127)!

If it bothers you, you can try to suppress the warning yourself. You likely need to add something like below to the relevant Gradle script in the android folder (note the below is for a KTS build script, it likely needs to be adapted to work in a Groovy build script typically used by Flutter projects):

// TODO Convert to Groovy to use in build.gradle (this is for a build.gradle.kts file)
tasks.withType(JavaCompile::class.java).configureEach {
    // Suppress JDK 21 warning about deprecated, but not yet removed, source and target value 8 support
    options.compilerArgs.add("-Xlint:-options")
}

Long term we need to use the Java 11 level to compile (Flutter appears to also prepare for that), but that has other complications (like a higher minimum supported Android SDK level).

@hagerf
Copy link

hagerf commented Jan 13, 2025

Thanks for the quick and detailed answer!
I assumed that it wouldn't. And thanks for the suggestions. Even though the warnings are a bit bothersome, I'm not a fan of suppressing warnings as they actually give useful information, in this case it means that some dependencies should be upgraded to compile with a newer version of Java. And even though I understand that raising the Android SDK level might not be something you want to do lightly, that's the real solution to this. Is there some thread or task to follow on Github for that?
Thanks again

@greenrobot-team
Copy link
Member Author

As part of this change I plan to suppress the warnings. And no, there is currently only an internal task to update to Java 11 level once it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants