'Unable to find bundled Java version on Flutter

I have Android Studio version 3.0
When I use the command flutter doctor it shows me the following,

Unable to find bundled Java version

My current Java version is (build 1.8.0_131-b11)



Solution 1:[1]

For Mac User

Set Java_Home path using below article & then after applying below command

https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/#what-is-usrlibexecjava-home

after that type below command on terminal

cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor -v

Edit #1:

For Mac users who are using JetBrains Toolbox, here is the solution:

Set Java_Home path using below article & then after applying below command

https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/#what-is-usrlibexecjava-home

after that type below command on terminal

change username to your macOS username

cd /Users/username/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7583922/Android Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor -v

Solution 2:[2]

For Windows: If you are using windows go to this directory C:\Program Files\Android\Android Studio and check older Android Studio folders are exist if exist delete those. it will work.

Solution 3:[3]

In my case, am using macOS, there was a copy of Android Studio Preview in my downloads folder. I just deleted that Android Studi Preview file and the error gone :)

Solution 4:[4]

Those on the Beta Versions of MAC OS Beta, Xcode Beta, Android Studio Preview.

Just ensure your path ways are correct to the Applications files for Flutter.

To fix JAVA Bundle for Android Studio Preview do this:

cd /Applications/Android\ Studio\ Preview.app/Contents/jre

ln -s ../jre jdk

ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

flutter doctor -v

Solution 5:[5]

Double check the path, solved my problem wrapping the path with quotation marks...

Before:

enter image description here

After:

enter image description here

Solution 6:[6]

Apple Silicon Users Problem Solved!

First do this: Flutter Doctor --android-licenses : Exception in thread "main" java.lang.NoClassDefFoundError

Then:

  1. Make Sure to set Java_Home path in .zshrc using same article already listed here. He explains using the .zshenv but we will edit .zshrc file.

https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/#what-is-usrlibexecjava-home

  1. Uninstall Java from your system
  2. Re-install the M1 Specific Version from Azul. Choose Java 16. Choose ARM 64 bit https://www.azul.com/downloads/?package=jdk

Here's Where I Was Stuck But Finally Found The Fix

Run these commands:

  1. cd /Applications/Android\ Studio.app/Contents/jre
  2. ln -s /Library/Java/JavaVirtualMachines/zulu-16.jdk jdk
  3. flutter doctor -v

Solution 7:[7]

if you are using Windows and install a new version of android, please check older Android Studio folders are exist or not in C:\Program Files\Android\Android Studio. if exist delete those. The errors will be gone!

Solution 8:[8]

I have recently encountered the same issue on Ubuntu 20.04 LTS.

After searching a lot I have fixed this issue by removing the Android Studio path from the Flutter config by running below mention command.

flutter config --android-studio-dir=   

Solution:

Solution

Solution 9:[9]

I was getting error as below,

enter image description here

Execute below steps to resolve this issue,

  1. Visit Google folder in user directory enter image description here
  2. Delete the AndroidStudio4.1 directory ( For which I was getting error ) enter image description here

Run "flutter doctor" again. My problem was fixed

Solution 10:[10]

Had this issue of ? Unable to find bundled Java version. Seems like the issue was with Android Studio (Beta Version)

Changed my Android Studio (Stable Version) to solve the issue

Here are the flutter doctor -v details for each Android Studio

Beta Android Studio

[!] Android Studio
    • Android Studio at /Applications/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.

Stable Android Studio

[?] Android Studio (version 4.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.8+10-b944.6916264)

Even after this issue persist then

  • Check for Java java -version which java

  • double-check that these are present in your .bashrc or .bash_profile or .zshrc

export PATH="$PATH:/usr/bin/java"
export JAVA_HOME=$(/usr/libexec/java_home)

Solution 11:[11]

I get this error this morning, when updated ANDROID STUDIO to new version, so to solve this problem you need to find previous version from https://developer.android.com/studio/archive and setup, it works for me! (sorry, if exists grammatical errors)

Solution 12:[12]

I use macos big sur 11.5.1 also have the above situation and have successfully fixed the error: Unable to find bundled Java version on Flutter && ! Some Android licenses are not accepted. To resolve this, run: flutter doctor --android-licenses CH-0 / 203.7678000 is the version you installed if you have to fix it

cd ~/Library/Application\ Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android\ Studio.app/Contents/jre

sudo ln -s ../jre jdk

sudo ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

flutter doctor --android-licenses

flutter doctor -v`

Solution 13:[13]

Please ensure Java is in your PATH and that JAVA_HOME is defined and pointing to the JDK. I've had Windows put the JRE in the path instead of the JDK, which leads to all kinds of issues.

Please take a look at your PATH environment variable and remove everything Java related that does not point to the JDK folder.

Oracle has some documentation on how to do this here : Installing Java and setting JAVA_HOME

Solution 14:[14]

The JAVA_HOME path, as stated in mkyong link by @Nalawala answer, must refer to a Java 1.8 JDK/JRE.

With Java 11 the flutter doctor --android-licenses command throws some ClassNotFoundException's

Solution 15:[15]

Uninstall Android Studio...

Delete folder $/Program Files/Android

Install Android studio...

$flutter doctor

Solution 16:[16]

In my case, there were two "Android Studio" folders. One was "Android Studio" and another was "Android Studio1", the "Android Studio1" had the actual app installed and the "Android Studio" folder was empty. Deleting the empty folder and renaming the "Android Studio1" to "Android Studio" fixed the issue.

Solution 17:[17]

In my case, I recently bought an M1 Macbook and then installed Android Studio with the Jetbrains Toolbox but

This folder doesn't exist

/Users/username/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7583922/Android Studio.app/Contents/jre

So I follow what this comment say and now is working just fine https://github.com/flutter/flutter/issues/76215#issuecomment-893512809

1.- Go to Applications folder then right click on your android studio app 2.- click on Show package contents 3.- open a terminal inside jre folder then create the new jdk folder

mkdir jdk

4.- move the folder Contents into jdk

mv Contents jdk

After refreshing my terminal, flutter doctor works just fine!

Solution 18:[18]

1.Write the path in quotes i.e flutter config --android-studio-dir "C:\Program Files\Android\Android Studio".

2.Please check the correct path of android Studio.

3.Do the 1st step and run flutter doctor .