5

When running command flutter doctor getting 1 issue:

[✓] Flutter (Channel stable, 2.8.1, on macOS 13.1 22C65 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[✓] VS Code (version 1.69.2)
[✓] Connected device (2 available)

System config:

macOS Ventura v13.1 | Intel chip

Android Studio Electric Eel(Stable version v2022.1.1)

JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home

java -version command is working perfectly in terminal.

Gaurav Singh
  • 2,200
  • 16
  • 30
  • try update Android cmdline-tools [this](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f0988aa1740d46b19ffc52a67c02cfa1~tplv-k3u1fbpfcp-zoom-in-crop-mark:4536:0:0:0.awebp?) – bakboem Jan 14 '23 at 02:41
  • @bakboem I've latest Android cmdline-tools – Gaurav Singh Jan 14 '23 at 05:02
  • try [this](https://stackoverflow.com/questions/51281702/unable-to-find-bundled-java-version-on-flutter?rq=1) – bakboem Jan 14 '23 at 05:26
  • Looks like with the release of Electrci Eel the directory where JRE lives changed to JRB. Check this [answer](https://stackoverflow.com/a/75119315/1233565). – Isaias Jan 16 '23 at 04:30
  • Just delete JRE folder: https://stackoverflow.com/questions/75108707/android-studio-electric-eel-javahome-seems-to-be-invalid/75116649#75116649 – AVEbrahimi Jan 23 '23 at 05:16

6 Answers6

14
  1. Go to your AndroidStudio folder

(e.g. C:\Program Files\Android\Android Studio) in Windows

  1. There you'll find the jbr and jre folder So all you need to do is to copy the content of jbr and paste the content into the jre folder.
ALI USAMA
  • 315
  • 1
  • 12
  • Yes, I confirm that this workaround works for me (on Windows). This is documented on this [GitHub Issue](https://github.com/flutter/flutter/issues/118502) and it should work also on Mac. The bug is also open on [Google Tracker](https://issuetracker.google.com/issues/247854802?pli=1) – Drake Jan 18 '23 at 13:07
  • @Ali Usama perfect solution. Worked instantly! – Ace Jan 29 '23 at 13:16
2

For Windows:

The problem is because of trace of old Android Studio java folder, just delete this folder and it starts working:

C:\Program Files\Android\Android Studio\jre

The new Android Studio Electric Eel is using jbr, not jre.


For macOS as @Jayanth replied above: If you are using macOS replace the path in .bash_profile or .zshrc

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"

with

export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
1

For Linux:

Run the following command in the terminal.

$ flutter config --android-studio-dir=
Z-100
  • 518
  • 3
  • 19
0

Open your AndroidStudio folder

copy All Content of "jbr" Folder into the "jre" folder.

Worked For Me.

Xlife
  • 21
  • 2
0

First Go On "C:\Program Files\Android\Android Studio" Copy All Data in jbr folder to jre

And

Set System Varaible (windows) Name: JAVA_HOME Value: C:\Program Files\Android\Android Studio\jre

Then Restart your terminal

0

I had two AndroidStudio folders. One was AndroidStudio other AndroidStudio1. After I deleted AndroidStudio (older) flutter doctor doesn't return warning.

bounxye
  • 183
  • 5
  • 13