I’m attempting to work on an older Flutter project in vscode, which won’t build with the latest Flutter version.
In an attempt to get it to build, I’ve downgraded Flutter to the version originally used by the previous dev, using git checkout 2.2.0
.
When I run flutter doctor
, all checks out except a warning under the Android Studio header that it is "Unable to find bundled Java version."
Things I’ve Tried:
The few well-known solutions for this that I’m aware of have been unsuccessful so far for my case:
- Create symlink
jre
to original directoryjbr
in/Applications/Android Studio.app/Contents/
. No luck. - Set
JAVA_HOME
explicity withexport JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"
in.bashrc
.JAVA_HOME
is now set, but I still get the error. Likewise when set tojbr
. - Android Studio updated and reinstalled.
Below is the output from flutter doctor -v
:
$ flutter doctor -v
[✓] Flutter (Channel unknown, 2.2.0, on macOS 13.6 22G120 darwin-x64, locale en-US)
• Flutter version 2.2.0 at /Users/bguiles/Development/flutter
• Framework revision b22742018b (2 years, 5 months ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/bguiles/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/bguiles/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/bguiles/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 15.0, Build version 15A240d
• CocoaPods version 1.13.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2022.3)
• 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.82.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.72.0
[✓] Connected device (2 available)
• iPhone 15 (mobile) • 64ED10B4-7FDA-44CF-B82E-AF4E36AF3269 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome
117.0.5938.132
! Doctor found issues in 1 category.
2
Answers
I solved this by completely uninstalling Android Studio and Flutter, reinstalling each, then creating a symlink
jre
to original directoryjbr
in/Applications/Android Studio.app/Contents/
.This has been a common issue. One solution from here that you don’t seem to mentioned:
This worked for me.