-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
[flutter doctor] Could not determine java version with JDK 21 #135402
Comments
I am currently facing this issue when i run flutter doctor If there is a version please look for an existing bug https://github.com/flutter/flutter/issues/ and if one does not ! Doctor found issues in 3 categories. Any fix for this please |
Thanks for filing a separate issue. Looking at both |
It fixed it, but I don't understand why I need to install Android Studio, just to use its JDK, when I already have an up-to-date JDK installed and Now, it completely ignores the installed JDK in favor of the one that came with Android Studio—output of
|
@mohabmetwalli |
Finally fixed this issues by installing JDK 17 |
Removing Android Studio, installing JDK 17, and running |
Thanks for the update. I just installed JDK 21 and now I can reproduce this issue. This is how I reproduce the issue: Steps to reproduce1. Find the Java version Flutter is using currently
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/jdk-21-oracle-x64/bin/javac 352321536 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1111 manual mode
2 /usr/lib/jvm/java-17-openjdk-amd64/bin/javac 1711 manual mode
3 /usr/lib/jvm/jdk-21-oracle-x64/bin/javac 352321536 manual mode
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
• Android SDK at /home/huynq/Android/Sdk/
• Platform android-31, build-tools 34.0.0-rc3
• Java binary at: /home/huynq/Documents/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted. Flutter currently uses Java 11. It prioritizes Android Studio's Java version first. If it's not found, then it will rely on Also, check Android Studio Java version as well for sure: huynq@ubuntu:~/Documents/android-studio/jre/bin$ ./java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
OpenJDK 64-Bit Server VM (build 11.0.11+0-b60-7590822, mixed mode) So it is. Flutter is using Android Studio java binary. 2. Reproduce the issue with Java JDK 21I will intentionally break Android Studio config so Flutter will seek Java in flutter config --android-studio-dir=/ Set JAVA_HOME to JDK 21: export JAVA_HOME=/usr/lib/jvm/jdk-21-oracle-x64 Check Flutter doctor and see the issue appears: huynq@ubuntu:~/Documents/android-studio/jre/bin$ flutter doctor -v
Could not parse java version from:
java 21 2023-09-19 LTS
Java(TM) SE Runtime Environment (build 21+35-LTS-2513)
Java HotSpot(TM) 64-Bit Server VM (build 21+35-LTS-2513, mixed mode, sharing)
... The issue doesn't happen if I switch to Java 11 or Java 17. Reproduced this issue on the latest Flutter stable/master channels. flutter doctor -v (stable & master)[✓] Flutter (Channel stable, 3.13.5, on Ubuntu 22.04.3 LTS 6.2.0-32-generic, locale en_US.UTF-8)
• Flutter version 3.13.5 on channel stable at /home/huynq/Documents/Working/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 12fccda598 (7 days ago), 2023-09-19 13:56:11 -0700
• Engine revision bd986c5ed2
• Dart version 3.1.2
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
• Android SDK at /home/huynq/Android/Sdk/
• Platform android-31, build-tools 34.0.0-rc3
• Java binary at: /home/huynq/Documents/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2
[✓] Android Studio (version 2021.1)
• Android Studio at /home/huynq/Documents/android-studio
• Flutter plugin version 67.0.1
• Dart plugin version 211.7817
• android-studio-dir = /home/huynq/Documents/android-studio
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] VS Code (version 1.82.2)
• VS Code at /usr/share/code
• Flutter extension version 3.72.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.3 LTS 6.2.0-32-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.187
[✓] Network resources
• All expected network resources are available.
• No issues found! [!] Flutter (Channel master, 3.15.0-10.0.pre.12, on Ubuntu 22.04.3 LTS 6.2.0-32-generic, locale en_US.UTF-8)
• Flutter version 3.15.0-10.0.pre.12 on channel master at /home/huynq/Documents/Working/flutter_master
! Warning: `flutter` on your path resolves to /home/huynq/Documents/Working/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter_master. Consider adding /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /home/huynq/Documents/Working/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter_master. Consider adding /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision bea63d7c81 (5 hours ago), 2023-09-26 20:46:25 -0400
• Engine revision 0a8ad236e4
• Dart version 3.2.0 (build 3.2.0-199.0.dev)
• DevTools version 2.28.0-dev.12
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
• Android SDK at /home/huynq/Android/Sdk/
• Platform android-31, build-tools 34.0.0-rc3
• Java binary at: /home/huynq/Documents/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2
[✓] Android Studio (version 2021.1)
• Android Studio at /home/huynq/Documents/android-studio
• Flutter plugin version 67.0.1
• Dart plugin version 211.7817
• android-studio-dir = /home/huynq/Documents/android-studio
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] VS Code (version 1.82.2)
• VS Code at /usr/share/code
• Flutter extension version 3.72.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.3 LTS 6.2.0-32-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.187
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category. |
I solved the problem without the android studio it turns out that flutter android tool chain doesn't currently suppor java 21 so all you need is to install another version of java for me it was java 17 that worked. |
@reidbaker It looks like the format of the version string has changed, and we are expecting at least one |
That is frustrating because it should have a dot in it based on the documentation. https://docs.oracle.com/en/java/javase/21/install/version-string-format.html#GUID-DCA60310-6565-4BB6-8D24-6FF07C1C4B4E |
There's a sneaky note at the end:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Just encountered this issue, agree with @reidbaker as
Since I see the |
Test case |
fixes /issues/135402 Edge case that was reported by a user along with a test case specifically covering their output.
fixes flutter/issues/135402 Edge case that was reported by a user along with a test case specifically covering their output.
…5495) Manual roll requested by tarrinneal@google.com flutter/flutter@b5f163a...6bf3ccd 2023-11-27 christopherfujino@gmail.com [flutter_tools] fix instructions to disable CLI animations (flutter/flutter#139094) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9fe149249957 to 900ce09b08b2 (3 revisions) (flutter/flutter#139095) 2023-11-27 jonahwilliams@google.com Wide gamut and platform view integration test. (flutter/flutter#138837) 2023-11-27 tessertaha@gmail.com Add ability to customize `NavigationBar` indicator overlay and fix indicator shape for the overlay (flutter/flutter#138901) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from cc57ace8e2e7 to 9fe149249957 (1 revision) (flutter/flutter#139077) 2023-11-27 andrewrkolos@gmail.com Add type validation to non-template .arb file parsing logic (flutter/flutter#139035) 2023-11-27 barpac02@gmail.com Update Android app project template to apply Kotlin Gradle plugin declaratively (flutter/flutter#139006) 2023-11-27 goderbauer@google.com Prepare for dynamically sized views - pt. 2 (flutter/flutter#139079) 2023-11-27 goderbauer@google.com Prepare for dynamically sized views (flutter/flutter#138565) 2023-11-27 JaspervanRiet@users.noreply.github.com Write tests for API examples of BottomNavigationBar and IconButton (flutter/flutter#138188) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9b610ecda771 to cc57ace8e2e7 (2 revisions) (flutter/flutter#139072) 2023-11-27 stuartmorgan@google.com Give an actionable error message when a Pod requires a higher minimum OS version (flutter/flutter#138097) 2023-11-27 reidbaker@google.com Edge case on flutter/flutter/issues/135402 with test (flutter/flutter#138814) 2023-11-27 engine-flutter-autoroll@skia.org Roll Packages from 97f0a40 to e774e88 (4 revisions) (flutter/flutter#139066) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6f499ecea657 to 9b610ecda771 (1 revision) (flutter/flutter#139063) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 61233cde4bb3 to 6f499ecea657 (2 revisions) (flutter/flutter#139051) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 292a92166a94 to 61233cde4bb3 (1 revision) (flutter/flutter#139041) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from ebebb25aaa46 to 292a92166a94 (3 revisions) (flutter/flutter#139037) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from eb18add9ebc5 to ebebb25aaa46 (2 revisions) (flutter/flutter#139034) 2023-11-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from 77432202f766 to eb18add9ebc5 (1 revision) (flutter/flutter#139007) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC rmistry@google.com,stuartmorgan@google.com,tarrinneal@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
In my case, I am setting
echo $JAVA_HOME
which java
java --version
flutter doctor -v
|
What you are seeing is expected behavior flutter prioritizes android studios java version over java_home and to change that now would break existing customers. |
@reidbaker |
You can upgrade the java version but it a bit more complicated. You can setup the environment variables for the android sdk then override the environment variable for android studio to something invalid. That will cause flutter to fallback to the java_home defined version of java. Here is a link to the code where we decide what version of java to use.
|
@tranvansang I just was reminded there is also an option to pass in the java directory as a config param Implementation here.
|
…lutter#5495) Manual roll requested by tarrinneal@google.com flutter/flutter@b5f163a...6bf3ccd 2023-11-27 christopherfujino@gmail.com [flutter_tools] fix instructions to disable CLI animations (flutter/flutter#139094) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9fe149249957 to 900ce09b08b2 (3 revisions) (flutter/flutter#139095) 2023-11-27 jonahwilliams@google.com Wide gamut and platform view integration test. (flutter/flutter#138837) 2023-11-27 tessertaha@gmail.com Add ability to customize `NavigationBar` indicator overlay and fix indicator shape for the overlay (flutter/flutter#138901) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from cc57ace8e2e7 to 9fe149249957 (1 revision) (flutter/flutter#139077) 2023-11-27 andrewrkolos@gmail.com Add type validation to non-template .arb file parsing logic (flutter/flutter#139035) 2023-11-27 barpac02@gmail.com Update Android app project template to apply Kotlin Gradle plugin declaratively (flutter/flutter#139006) 2023-11-27 goderbauer@google.com Prepare for dynamically sized views - pt. 2 (flutter/flutter#139079) 2023-11-27 goderbauer@google.com Prepare for dynamically sized views (flutter/flutter#138565) 2023-11-27 JaspervanRiet@users.noreply.github.com Write tests for API examples of BottomNavigationBar and IconButton (flutter/flutter#138188) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9b610ecda771 to cc57ace8e2e7 (2 revisions) (flutter/flutter#139072) 2023-11-27 stuartmorgan@google.com Give an actionable error message when a Pod requires a higher minimum OS version (flutter/flutter#138097) 2023-11-27 reidbaker@google.com Edge case on flutter/flutter/issues/135402 with test (flutter/flutter#138814) 2023-11-27 engine-flutter-autoroll@skia.org Roll Packages from 97f0a40 to e774e88 (4 revisions) (flutter/flutter#139066) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6f499ecea657 to 9b610ecda771 (1 revision) (flutter/flutter#139063) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 61233cde4bb3 to 6f499ecea657 (2 revisions) (flutter/flutter#139051) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 292a92166a94 to 61233cde4bb3 (1 revision) (flutter/flutter#139041) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from ebebb25aaa46 to 292a92166a94 (3 revisions) (flutter/flutter#139037) 2023-11-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from eb18add9ebc5 to ebebb25aaa46 (2 revisions) (flutter/flutter#139034) 2023-11-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from 77432202f766 to eb18add9ebc5 (1 revision) (flutter/flutter#139007) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC rmistry@google.com,stuartmorgan@google.com,tarrinneal@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
For anyone interested in, flutter config (.e.g, setup via
|
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
fixes flutter/issues/135402 Edge case that was reported by a user along with a test case specifically covering their output.
Is there an existing issue for this?
Steps to reproduce
jdk-openjdk
and its dependencies.flutter
using the official.tar
Actual results
In #134333, I was instructed to open a new issue after making sure Java is properly installed. I made sure
java --version
successfully executes (output included in logs); furthermore, it's evident in the output offlutter doctor --verbose
thatflutter
detects the java binary, and can successfully runjava --version
but fails to parse the output.Logs
Logs
java --version
:Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: