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

[flutter doctor] Could not determine java version with JDK 21 #135402

Closed
2 tasks done
mohabmetwalli opened this issue Sep 25, 2023 · 24 comments · Fixed by #138155 or #138814
Closed
2 tasks done

[flutter doctor] Could not determine java version with JDK 21 #135402

mohabmetwalli opened this issue Sep 25, 2023 · 24 comments · Fixed by #138155 or #138814
Assignees
Labels
found in release: 3.13 Found to occur in 3.13 found in release: 3.15 Found to occur in 3.15 fyi-android For the attention of Android platform team has reproducible steps The issue has been confirmed reproducible and is ready to work on r: fixed Issue is closed as already fixed in a newer version t: flutter doctor Problem related to the "flutter doctor" tool team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@mohabmetwalli
Copy link

Is there an existing issue for this?

Steps to reproduce

  1. Run an Arch-based Linux distribution.
  2. Install jdk-openjdk and its dependencies.
  3. Install 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 of flutter doctor --verbose that flutter detects the java binary, and can successfully run java --version but fails to parse the output.

Logs

Logs

java --version:

openjdk 21 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)

Flutter Doctor output

Doctor output
Could not parse java version from:
openjdk 21 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)

If there is a version please look for an existing bug
https://github.com/flutter/flutter/issues/ and if one does not exist
file a new issue.
[✓] Flutter (Channel stable, 3.13.5, on Artix Linux 6.5.4-artix2-1,
    locale en_US.utf8)
    • Flutter version 3.13.5 on channel stable at
      /home/mohab/.local/share/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12fccda598 (5 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)
    • Android SDK at /opt/android-sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /opt/android-sdk
    • ANDROID_SDK_ROOT = /opt/android-sdk
    • Java binary at: /usr/bin/java
    ✗ Could not determine java version
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at
    google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome
      executable.

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt
      install clang), or can be downloaded from
      https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt
      install cmake), or can be downloaded from
      https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt
      install ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    • pkg-config version 1.8.1

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit
      https://flutter.dev/docs/get-started/install/linux#android-setu
      p for detailed instructions).

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Artix Linux
      6.5.4-artix2-1

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 4 categories.
@kiisi
Copy link

kiisi commented Sep 25, 2023

I am currently facing this issue when i run flutter doctor
I installed JDK 21
`
Doctor summary (to see all details, run 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)

If there is a version please look for an existing bug https://github.com/flutter/flutter/issues/ and if one does not
exist file a new issue.
[√] Flutter (Channel stable, 3.13.3, on Microsoft Windows [Version 10.0.19045.3448], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
X Could not determine java version
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[!] Android Studio (not installed)
[√] VS Code (version 1.82.2)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 3 categories.
`

Any fix for this please

@huycozy huycozy added the in triage Presently being triaged by the triage team label Sep 25, 2023
@huycozy
Copy link
Member

huycozy commented Sep 25, 2023

Thanks for filing a separate issue. Looking at both flutter doctor outputs above, I notice Android Studio hasn't been installed yet. Maybe the issue can be solved if you install it. Can you try to see if it helps?

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 25, 2023
@mohabmetwalli
Copy link
Author

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 flutter can locate it?

Now, it completely ignores the installed JDK in favor of the one that came with Android Studio—output of flutter doctor --verbose:

[✓] Flutter (Channel stable, 3.13.5, on Artix Linux 6.5.4-artix2-1, locale
    en_US.utf8)
    • Flutter version 3.13.5 on channel stable at
      /home/mohab/.local/share/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12fccda598 (6 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)
    • Android SDK at /opt/android-sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /opt/android-sdk
    • ANDROID_SDK_ROOT = /opt/android-sdk
    • Java binary at: /opt/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at
    google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome
      executable.

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang),
      or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake),
      or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install
      ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    • pkg-config version 1.8.1

[!] Android Studio (version unknown)
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Artix Linux 6.5.4-artix2-1

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 3 categories.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 25, 2023
@darshankawar
Copy link
Member

@mohabmetwalli
Check this link and see if it helps to answer your question.

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 26, 2023
@kiisi
Copy link

kiisi commented Sep 26, 2023

Finally fixed this issues by installing JDK 17

@mohabmetwalli
Copy link
Author

Removing Android Studio, installing JDK 17, and running sudo archlinux-java set java-17-openjdk fixed it for me too. It seems flutter has a problem with JDK 21, for some reason.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 26, 2023
@huycozy
Copy link
Member

huycozy commented Sep 27, 2023

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 reproduce

1. Find the Java version Flutter is using currently

  • Check current available Java versions on system
  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
  • Check the current Java version used by Flutter
[✓] 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 JAVA_HOME path (see #106416 (comment)).

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 21

I will intentionally break Android Studio config so Flutter will seek Java in JAVA_HOME:

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.

@huycozy huycozy added tool Affects the "flutter" command-line tool. See also t: labels. t: flutter doctor Problem related to the "flutter doctor" tool has reproducible steps The issue has been confirmed reproducible and is ready to work on team-tool Owned by Flutter Tool team found in release: 3.13 Found to occur in 3.13 found in release: 3.15 Found to occur in 3.15 and removed in triage Presently being triaged by the triage team labels Sep 27, 2023
@huycozy huycozy changed the title [flutter doctor] Could not determine java version [flutter doctor] Could not determine java version with JDK 21 Sep 27, 2023
@Sparks1998
Copy link

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.

@stuartmorgan stuartmorgan added the fyi-android For the attention of Android platform team label Oct 19, 2023
@stuartmorgan
Copy link
Contributor

@reidbaker It looks like the format of the version string has changed, and we are expecting at least one . in the version.

@reidbaker reidbaker self-assigned this Oct 19, 2023
@reidbaker
Copy link
Contributor

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

@stuartmorgan
Copy link
Contributor

There's a sneaky note at the end:

The version string doesn't have trailing zero elements. For example, if the value of $FEATURE is 21, the value of $INTERIM is 0, the value of $UPDATE is 1, and the value of $PATCH is 0, then the full version string is 21.0.1.

@WGinit

This comment was marked as off-topic.

@vmlinuz
Copy link

vmlinuz commented Oct 20, 2023

Just encountered this issue, agree with @reidbaker as flutter doctor expects that java version string should look something like 'openjdk 19.0.2 2023-01-17'. In packages/flutter_tools/lib/src/android/java.dart in the flutter repo, in checking the JDK version string, the following code was found:

// The contents that matter come in the format '11.0.18' or '1.8.0_202'.
final RegExp jdkVersionRegex = RegExp(r'\d+\.\d+(\.\d+(?:_\d+)?)?');

Since I see the java 21 2023-09-19 LTS string when executing the java --version, the code above should be fixed.

@reidbaker
Copy link
Contributor

Test case
"""
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)
"""

@huycozy huycozy removed the r: fixed Issue is closed as already fixed in a newer version label Nov 21, 2023
reidbaker added a commit that referenced this issue Nov 21, 2023
auto-submit bot pushed a commit that referenced this issue Nov 27, 2023
fixes /issues/135402
Edge case that was reported by a user along with a test case specifically covering their output.
Markzipan pushed a commit to Markzipan/flutter that referenced this issue Nov 27, 2023
fixes flutter/issues/135402
Edge case that was reported by a user along with a test case specifically covering their output.
auto-submit bot pushed a commit to flutter/packages that referenced this issue Nov 28, 2023
…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
@huycozy huycozy added the r: fixed Issue is closed as already fixed in a newer version label Nov 28, 2023
@tranvansang
Copy link

In my case, I am setting java 21.0.1 2023-10-17 LTS but flutter doctor and other flutter commands consistently report java version from android studio.

    • Java binary at: /home/ninja/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java

echo $JAVA_HOME

/opt/jdk

which java

/opt/jdk/bin/java

java --version

java 21.0.1 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)

flutter doctor -v

[✓] Flutter (Channel stable, 3.16.3, on Arch Linux 6.5.7-arch1-1, locale en_US.UTF-8)
    • Flutter version 3.16.3 on channel stable at /opt/flutter_linux_3.16.3-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0366e0a3f (4 days ago), 2023-12-05 19:46:39 -0800
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
    • Android SDK at /home/ninja/Android/Sdk
    • Platform android-34, build-tools 34.0.0-rc3
    • Java binary at: /home/ninja/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome-stable

[✓] Linux toolchain - develop for Linux desktop
    • clang version 16.0.6
    • cmake version 3.27.7
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[✓] Android Studio (version 2023.1)
    • Android Studio at /home/ninja/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin version 76.3.3
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.3)
    • IntelliJ at /home/ninja/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate
    • Flutter plugin version 76.3.4
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Arch Linux 6.5.7-arch1-1
    • Chrome (web)    • chrome • web-javascript • Google Chrome 118.0.5993.70

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@reidbaker
Copy link
Contributor

In my case, I am setting java 21.0.1 2023-10-17 LTS but flutter doctor and other flutter commands consistently report java version from android studio.

    • Java binary at: /home/ninja/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java

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.

@tranvansang
Copy link

@reidbaker
Thank you for your comment. Since Android Studio bundles this java version directly (by looking at the java bin path), we cannot upgrade the java version. Am I understanding correctly?

@reidbaker
Copy link
Contributor

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.
Your other option is to not install Android studio and only install the android sdks you might do that on a build machine for example.

Here is a link to the code where we decide what version of java to use.

/// Finds the Java runtime environment that should be used for all java-dependent

@reidbaker
Copy link
Contributor

@tranvansang I just was reminded there is also an option to pass in the java directory as a config param
flutter config --jdk-dir

Implementation here.

final Object? configured = config.getValue('jdk-dir');

HugoOlthof pushed a commit to moneybird/packages that referenced this issue Dec 13, 2023
…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
@tranvansang
Copy link

For anyone interested in, flutter config (.e.g, setup via flutter config) is stored in $HOME/.config/flutter/settings

{
  "jdk-dir": "/opt/jdk"
}

Copy link

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2023
caseycrogers pushed a commit to caseycrogers/flutter that referenced this issue Dec 29, 2023
fixes flutter/issues/135402
Edge case that was reported by a user along with a test case specifically covering their output.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
found in release: 3.13 Found to occur in 3.13 found in release: 3.15 Found to occur in 3.15 fyi-android For the attention of Android platform team has reproducible steps The issue has been confirmed reproducible and is ready to work on r: fixed Issue is closed as already fixed in a newer version t: flutter doctor Problem related to the "flutter doctor" tool team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet