-2

flutter doctor -v fails due to missing Java:

[✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-arm, locale en-US)
    • Flutter version 3.3.10 on channel stable at /opt/homebrew/Caskroom/flutter/3.3.10/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (4 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/hahnemann/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Library/Java/JavaVirtualMachines/temurin-19.jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Temurin-19.0.1+10 (build 19.0.1+10)
    • All Android licenses accepted.

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

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

[!] Android Studio (version 2022.1)
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C65 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.87

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

I have Java installed from Adoptium using Brew. I already tried flutter doctor --android-licenses and removed the obsolete version of Android SDK Tools:

enter image description here

What could be wrong?

Hahnemann
  • 4,378
  • 6
  • 40
  • 64

4 Answers4

1

Follow these steps:

  1. Go to Applications folder and find Android Studio app
  2. Right click on it and hit Show Package Contents
  3. Navigate to Contents, then right click on "jbr"
  4. Hit duplicate
  5. Rename the duplicate folder to "jre"

Done!!

ossamacpp
  • 656
  • 5
  • 11
0

Apparently it's an open issue with Android Studio Electric Eel 2022.1.1 after I upgraded using Brew. The workaround is:

cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre
Hahnemann
  • 4,378
  • 6
  • 40
  • 64
  • Just upgraded to Electric Eel 2022.1.1 and now the `ln -s jbr jre` workaround does not work anymore - and the [issue is closed](https://github.com/flutter/flutter/issues/106674)! – Hahnemann Feb 04 '23 at 17:06
0

On Linux Operating System do this

cd /opt/android-studio

then

ln -s jbr jre 
0

For Windows you can try this:

  1. Open a terminal with admin permissions (e.g. Press Win and type "cmd", "powershell" or "terminal", whatever you prefer, and press Ctrl+Shift+Enter)

  2. Then type:

     cd C:\Program Files\Android\Android Studio
     mklink /D "jre" "jbr"
    

Hints

If you have installed Android Studio in a different directory change the path.
If there is a almost jre directory you can simply delete it with rmdir /s jre this was the case on my system after an update to Electric Eel (2022.1.1).

rekire
  • 47,260
  • 30
  • 167
  • 264