I updated android studio to Electric El, but after updating, it is unable to find Java Runtime.
Flutter doctor gives this error and the code does not compile.
maazaftab@maazs-MacBook-Pro edge-focus-mobile % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
[✓] Flutter (Channel beta, 3.7.0-1.2.pre, on macOS 13.0.1 22A400 darwin-arm64, locale en-PK)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ Could not determine java version
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2022.3)
[✓] VS Code (version 1.62.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 2 categories.
2
Answers
In your zshrc file add.
Restart the android studio. Flutter doctor will give this.
You can ignore the warning ✗ Unable to find bundled Java version. but the code will compile successfully.
Open the folder where Android Studio is installed.
In most cases, it is "C:Program FilesAndroidAndroid Studio"
Android Studio folder screenshot
Environment screenshot