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

Cannot find bundled Java version on AS 2022.1.1.x (Electric Eel) #106674

Closed
RoarGronmo opened this issue Jun 24, 2022 · 72 comments · Fixed by #119244 or #120107
Closed

Cannot find bundled Java version on AS 2022.1.1.x (Electric Eel) #106674

RoarGronmo opened this issue Jun 24, 2022 · 72 comments · Fixed by #119244 or #120107
Assignees
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version t: flutter doctor Problem related to the "flutter doctor" tool tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@RoarGronmo
Copy link

Thanks for the feedback! If your issue is related to the Flutter framework itself,
please open an issue at
github.com/flutter/flutter.

Steps to Reproduce

Was redirected here to file an issue when using AS Chipmunk and running flutter doctor which complaints about missing bundled Java version in AS Electric Eel. See issue: https://issuetracker.google.com/237019251

Referencing it here:

Build: AI-212.5712.43.2112.8609683, 202205181650,

AI-212.5712.43.2112.8609683, JRE 11.0.12+7-b1504.28-7817840x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920.0x1080.0, 1920.0x1080.0, 1920.0x1080.0, 768.0x1366.0

AS: Chipmunk | 2021.2.1 Patch 1; Kotlin plugin: 212-1.7.0-release-281-AS5457.46; Android Gradle Plugin: (plugin information not found); Gradle: (gradle version information not found); Gradle JDK: version 11.0.12; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)

IMPORTANT: Please read https://developer.android.com/studio/report-bugs.html carefully and supply all required information.

Is this a known issue that AS Electic Eel don't provide known bundled java location when using it with Flutter 3.1 (beta) ? (seen from ChipMunk flutter doctor).

May this be related to same foundation problem discovered in AS EE after ugrade to AS EE C4 (or C5): https://issuetracker.google.com/issues/236055498

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 3.1.0-9.0.pre, on Microsoft Windows [Version 10.0.22000.739], locale nb-NO)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.3)
[√] Android Studio (version 2020.3)
[√] Android Studio (version 2021.1)
[√] Android Studio (version 2021.2)
[√] Android Studio (version 2021.1)
[√] Android Studio (version 2021.2)
[√] Android Studio (version 2021.3)
[!] Android Studio (version 2022.1)
    X Unable to find bundled Java version.
[√] Connected device (4 available)
[√] HTTP Host Availability

! Doctor found issues in 1 category.

Version info

PS C:\FlutterProjects\mwork> flutter doctor -v
[√] Flutter (Channel beta, 3.1.0-9.0.pre, on Microsoft Windows [Version 10.0.22000.739], locale nb-NO)
    • Flutter version 3.1.0-9.0.pre at c:\Flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f28e570c8c (10 days ago), 2022-06-14 13:39:33 -0500
    • Engine revision 74ee6b5afd
    • Dart version 2.18.0 (build 2.18.0-165.1.beta)
    • DevTools version 2.14.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at C:\Users\roarg\AppData\Local\Android\Sdk
    • Platform android-TiramisuPrivacySandbox, build-tools 33.0.0
    • ANDROID_HOME = C:\Users\roarg\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android Studio\Android Studio 2021.3.1.13\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31702.278
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2020.3.1.26
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2021.1.1.23
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2021.2.1.15
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Android Studio (version 2020.3_new)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2020.3.1.4
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2021.1.1.13
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2021.2.1.11
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Android Studio (version 2021.3)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2021.3.1.13
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[!] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android Studio\Android Studio 2022.1.1.5
    • 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
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[√] Connected device (4 available)
    • SM T515 (mobile)  • R52NB09L7ZP • android-arm    • Android 11 (API 30)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.22000.739]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 103.0.5060.53
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 102.0.1245.39

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Please paste the output of running flutter doctor -v here (available from the command
line or from Tools > Flutter > Flutter Doctor). It will provide the version of the
Flutter framework as well as of the IntelliJ plugin.

@RoarGronmo
Copy link
Author

Please note following comment: https://issuetracker.google.com/issues/237019251#comment2

@helin24 helin24 transferred this issue from flutter/flutter-intellij Jun 27, 2022
@huycozy huycozy added the in triage Presently being triaged by the triage team label Jun 28, 2022
@huycozy
Copy link
Member

huycozy commented Jun 28, 2022

Hi @RoarGronmo, thanks for filing the issue
Could you please try these solutions to see if this issue still reproduces?
https://stackoverflow.com/a/67999421
https://stackoverflow.com/a/51286951

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 28, 2022
@RoarGronmo
Copy link
Author

The first suggestion is a no op, since I rely on older versions to have a backend to run into when newer versions doesn't work as expected.

The second is a known issue, and my environment works as expected with my environment settings as is, except for the AS EE C5 update which suddenly points to new locations where JDK 11 wasn't installed. At the moment I rely on AS Chipmunk for Flutter projects and I use AS EE on kotlin projects. While updating (first start) of AS EE, I think I got a question if I want to use embedded JDK version and I fell back to that one, unknowningly if it used the JAVA_HOME defined one or the one actually installed aside AS. At the moment it seems that AS EE works, but Flutter doesn't find it since AS EE C4+ has changed it's standard position.

In my point of view, AS / IntelliJ should rely on its own JDK defined location, until the user overrides it in AS settings. And AS should clearly emphasize which versions are in use and where/how they are used.

I am in Windows 11 and for inexperienced users, it is quite cumbersome to find the environment variables and change them.

I install AS with "downlading zip, unblock, unpack and move folder to Program Files"- method.

@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 Jun 28, 2022
@huycozy
Copy link
Member

huycozy commented Jun 28, 2022

@RoarGronmo
Android Studio Electric Eel | 2022.1.1 is still in Canary. And there is similar old issue that has been filed before due to the Preview version of Android Studio. So, please use the stable version until this gets resolved.

I also confirm that the issue is reproducible on the latest stable and master channels after install new Android Studio Electric Eel on Windows and Mac machines.

flutter doctor -v (Windows)
[√] Flutter (Channel stable, 3.0.3, on Microsoft Windows [Version 10.0.19043.1766], locale en-US)
    • Flutter version 3.0.3 at C:\WIP\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 676cefaaff (6 days ago), 2022-06-22 11:34:49 -0700
    • Engine revision ffe7b86a1e
    • Dart version 2.17.5
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at C:\AndroidSDK
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = C:\AndroidSDK
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.2.32616.157
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android\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
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[!] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1
    • 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
    X Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[√] VS Code (version 1.68.1)
    • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.42.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1766]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 102.0.5005.115
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 101.0.1210.53

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
flutter doctor -v (Mac)
[✓] Flutter (Channel stable, 3.0.3, on macOS 12.2.1 21D62 darwin-x64, locale en-VN)
    • Flutter version 3.0.3 at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 676cefaaff (6 days ago), 2022-06-22 11:34:49 -0700
    • Engine revision ffe7b86a1e
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-33, build-tools 31.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[!] Android Studio
    • Android Studio at /Users/huynq/Downloads/Android Studio Preview.app/Contents
    • 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 find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
    • 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

[✓] VS Code (version 1.68.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Labeling this issue for further support/investigation.

@huycozy huycozy added platform-android Android applications specifically 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 found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 and removed in triage Presently being triaged by the triage team labels Jun 28, 2022
@TahaTesser TahaTesser removed the platform-android Android applications specifically label Jun 28, 2022
@christopherfujino christopherfujino added the P2 Important issues not at the top of the work list label Jun 28, 2022
@RoarGronmo
Copy link
Author

Will just mention (as you may be aware of) that the same problem exists for AS Flamingo, at least for Canary 3.

@archerallstars
Copy link

I am using:

Android Studio Electric Eel | 2022.1.1 Beta 2
Build #AI-221.6008.13.2211.9113387, built on September 27, 2022
Runtime version: 11.0.15+0-b2043.56-8887301 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.0.0-1-default
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false

Non-Bundled Plugins:
    Dart (221.6008.17)
    io.flutter (70.2.4)

Current Desktop: GNOME

My flutter doctor -v returns:

[✓] Flutter (Channel stable, 3.3.4, on openSUSE Tumbleweed 6.0.0-1-default,
    locale en_US.UTF-8)
    • Flutter version 3.3.4 on channel stable at
      /home/archerallstars/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (4 days ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/archerallstars/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /usr/lib64/jvm/jre-openjdk/bin/java
    • Java version OpenJDK Runtime Environment (IcedTea 3.24.0) (build
      1.8.0_345-b01 suse-2.2-x86_64)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[!] Android Studio (version 2022.1)
    • Android Studio at /home/archerallstars/android-studio
    • Flutter plugin version 70.2.4
    • Dart plugin version 221.6008.17
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • openSUSE Tumbleweed
      6.0.0-1-default
    • Chrome (web)    • chrome • web-javascript • Google Chrome 106.0.5249.103

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

@Khazbs
Copy link

Khazbs commented Oct 21, 2022

Coming here from #113775. This issue may be caused by the fact that newer versions of Android Studio come with JBR as a bundled Java version. If Flutter Tools included the directory jbr/Contents/Home to look for Java in, this issue could be (at least partially) fixed.

@justintime4tea
Copy link

As a workaround I have just created a symbolic link.

# ln -s  TARGET              LINK_NAME
ln -s /usr/lib/jvm/java-17 $USER/.local/lib/android-studio/jre
  • Replace TARGET /usr/lib/jvm/java-17 with the location of your JDK home.
  • Replace LINK_NAME $USER/.local/lib/android-studio with the location of your Android Studio

@dong-lufei
Copy link

@justintime4tea How to solve this problem under windows11:

$ flutter doctor -v
[✓] Flutter (Channel stable, 3.3.8, on Microsoft Windows [版本 10.0.22000.1219], locale zh-CN)
• Flutter version 3.3.8 on channel stable at D:\Program_Files\scoop\apps\flutter\current
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc2 (2 weeks ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at D:\Program_Files\scoop\apps\android-sdk\current
• Platform android-TiramisuPrivacySandbox, build-tools 33.0.1
• ANDROID_HOME = D:\Program_Files\scoop\apps\android-sdk\current
• Java binary at: D:\Program_Files\scoop\apps\openjdk17\current\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.2+8-86)
• All Android licenses accepted.

[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.1)
• Visual Studio at D:\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33110.190
• Windows 10 SDK version 10.0.22000.0

[!] Android Studio (version 2022.2)
• Android Studio at D:\Program_Files\scoop\apps\android-studio-canary\current
• 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 find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
• IntelliJ at D:\Program Files\JetBrains\IntelliJ IDEA 2021.2
• 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

[✓] Proxy Configuration
• HTTP_PROXY is set
• NO_PROXY is 127.0.0.1;localhost;::1
• NO_PROXY contains localhost
• NO_PROXY contains ::1
• NO_PROXY contains 127.0.0.1

[✓] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.22000.1219]
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.107

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 1 category.

@justintime4tea
Copy link

justintime4tea commented Nov 23, 2022

@git136975643 try creating a symbolic link within your Android Studio directory with the name "jre" with the target being your java JDK directory.

From the look of your logs, maybe this will work? (PowerShell)

# New-Item -ItemType SymbolicLink -Path "LINK_PATH" -Target "TARGET_PATH"

New-Item -ItemType SymbolicLink -Path "D:\Program_Files\scoop\apps\openjdk17\current\bin\java" -Target "D:\Program_Files\scoop\apps\android-studio-canary\current\jre"

Afterwards try running flutter doctor again.

This is essentially the Windows equivalent to my previous comment.

@dong-lufei
Copy link

dong-lufei commented Nov 23, 2022

Uninstall and install flutter or permanently set the JAVA environment variable(JAVA_HOME) to your locally installed JDK path, if it doesn’t work, just
Open android-studio, go to the settings menu to find the language and framework, then find the fultter menu, and associate the path of the flutter installed on your computer

@timbophillips
Copy link

For windows 11 this worked for me.
From within the android-studio folder

New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr

@JasonChiu-dev
Copy link

JasonChiu-dev commented Jan 13, 2023

For MacBook M1:

Step 1: Change directory to the subdirectory (Contents) of the Android Studio forder:

Android Studio.app/Contents

Step 2: Create a symbolic link named jre and point it to jbr:

ln -s jbr jre

@firestormza
Copy link

For windows 11 this worked for me. From within the android-studio folder

New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr

Just upgraded to Electic Eel now and having the same issue on Win10.
I deleted the old (mostly empty) /jre folder and added the Symlink.
Now all is working again.

@max-torch
Copy link

For MacBook M1:

Step 1: Change directory to the subdirectory (Contents) of the Android Studio forder:

Android Studio.app/Contents

Step 2: Create a symbolic link named jre and point it to jbr:

ln -s jbr jre

This worked for me on Ubuntu 22.04.1 LTS, so this instruction is not just for Mac.

@JasonChiu-dev
Copy link

JasonChiu-dev commented Jan 13, 2023

Good to know this approach works here too.

I think this works on all Unix-like systems - use the same shell command.

Step 1: Change directory to the subdirectory (Contents) of the Android Studio forder:

Android Studio.app/Contents

Step 2: Create a symbolic link named jre and point it to jbr:

ln -s jbr jre

@hahnemann
Copy link

This is still broken in macOS. I just upgraded AS to Electric Eel 2022.1.1 Patch 1 and Flutter doctor throws the same old error. And what is worse, the ln -s jbr jre workaround is not permitted anymore, not even with sudo.

@TahaTesser TahaTesser reopened this Feb 6, 2023
@TahaTesser
Copy link
Member

#119244 is reverted.

@christopherfujino christopherfujino self-assigned this Feb 6, 2023
@christopherfujino
Copy link
Member

#119244 is reverted.

I will work to get this re-landed

@Samsonroyal
Copy link

was this issue resolved, my electric eel displayed a similar error on running flutter doctor

@ameuret
Copy link

ameuret commented Feb 8, 2023

was this issue resolved, my electric eel displayed a similar error on running flutter doctor

Yes but it has still not found its way into stable yet so the current release is still broken. Use the one of the symlink workarounds for your platform.

@zacharypuulsedev
Copy link

This is still broken in macOS. I just upgraded AS to Electric Eel 2022.1.1 Patch 1 and Flutter doctor throws the same old error. And what is worse, the ln -s jbr jre workaround is not permitted anymore, not even with sudo.

Check out this guide. Worked fine on my m1.
https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/

@JasonChiu-dev
Copy link

JasonChiu-dev commented Feb 9, 2023

This is still broken in macOS. I just upgraded AS to Electric Eel 2022.1.1 Patch 1 and Flutter doctor throws the same old error. And what is worse, the ln -s jbr jre workaround is not permitted anymore, not even with sudo.

Check out this guide. Worked fine on my m1. https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/

This is the correct way to

Fix Terminal “Operation not permitted” Error in macOS.

@RoarGronmo
Copy link
Author

Seems to be solved in beta 3.8.0:

Flutter 3.8.0-10.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 1a0a03a41d (3 days ago) • 2023-02-16 22:03:58 -0600
Engine • revision 639e313f99
Tools • Dart 3.0.0 (build 3.0.0-218.1.beta) • DevTools 2.21.1

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 3.8.0-10.1.pre, on Microsoft Windows [Version 10.0.22621.1265], locale nb-NO)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.3)
[√] Android Studio (version 2021.2)
[√] Android Studio (version 2021.3)
[√] Android Studio (version 2022.1)
[√] Android Studio (version 2022.1)
[√] Android Studio (version 2022.2)
[√] Android Studio (version 2022.3)
[√] Connected device (3 available)
[√] HTTP Host Availability

• No issues found!

@gnprice
Copy link
Member

gnprice commented Feb 27, 2023

I've filed a cherry-pick PR to see about getting this fix into the 3.7.x stable series: #121504 / #121505.

@JasonChiu-dev
Copy link

JasonChiu-dev commented Mar 2, 2023

Happy to hear that Flutter 3.7.6 (Mar 01, 2023) - Fixes an issue where Flutter is unable to find the current JDK in specific versions of Android Studio.

https://github.com/flutter/flutter/wiki/Hotfixes-to-the-Stable-Channel

@under3415
Copy link

Hi,
This issue is not really fixed.
Flutter doctor is no longer complaining, but when you try to actually run the app in an emulator or build it then it fails with below error:

Exception: Found syntax errors.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
main.dart:1

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Android\Android Studio\jre\bin\java.exe

In Windows environment configuration JAVA_HOME is set to jbr, so not sure why is flutter still looking in jre.

To resolve the problem I reverted to the old workaround of making a symbolic link from jre to jbr folder (same thing that used to work for flutter doctor issue).

My flutter doctor output is:

[√] Flutter (Channel stable, 3.7.7, on Microsoft Windows [Version 10.0.19045.2728], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.2)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2022.1)
[√] VS Code (version 1.76.1)
[√] Connected device (4 available)
[√] HTTP Host Availability

@gnprice
Copy link
Member

gnprice commented Mar 15, 2023

@under3415 Please file a new issue. That will be a much more effective place to investigate and resolve the issue you're seeing than the thread for this old fixed issue is.

When you do, please include the command you're running and its complete output.

@github-actions
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 Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version t: flutter doctor Problem related to the "flutter doctor" tool tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet