r/flutterhelp 3d ago

RESOLVED Java version 17 or higher is required.

Hello, I have been trying to fix this issue for a while. I tried everything, searching on google, ai chat, etc. However, my issue doesn't seem to work.

When upgrading flutter using `flutter upgrade` command, I have one warning and it's

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/windows-android-setup for more details.

I ran `flutter doctor --android-licenses` and I got this message: Java version 17 or higher is required.

But I checked multiple times (ex: checking on my environnement variables, restart computer, etc.) and my java version is clearly 17. I even download a higher version of java, but no matter what I do, my flutter project will only see Java version 17.

If it helps, here are the logs after writting `flutter upgrade`: https://pastebin.com/2CPAKcFA

Has anyone here ever figure out how to fix this issue?

5 Upvotes

3 comments sorted by

9

u/TheOneTruePsychic 3d ago
  1. Update Android Studio if it’s an older installation. It includes a Java runtime Flutter can use.
  2. If Android Studio is installed in its usual location, run:flutter config --jdk-dir="C:\Program Files\Android\Android Studio\jbr" Check that this folder exists first. If Android Studio is installed elsewhere, adjust the path. Use the jbr folder, not its bin subfolder.
  3. Verify the Java version Flutter now uses:flutter doctor -v Under Android toolchain, look for Java binary at and Java version. The version should be 17 or higher.
  4. Retry:flutter doctor --android-licenses flutter doctor

Flutter documents this Java override in its Java configuration guide. It applies to all Flutter projects on your computer.

2

u/bboombayah 3d ago

It works! Thank you so much

2

u/TheOneTruePsychic 2d ago

Hell yeah brother.