Unable to find bundled Java version on Flutter

Flutter

Flutter Problem Overview


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)

Flutter Solutions


Solution 1 - Flutter

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 - Flutter

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 - Flutter

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 - Flutter

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 - Flutter

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 - Flutter

Apple Silicon Users Problem Solved!

First do this: https://stackoverflow.com/questions/64708446/flutter-doctor-android-licenses-exception-in-thread-main-java-lang-noclass

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 - Flutter

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 - Flutter

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 - Flutter

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 10 - Flutter

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 11 - Flutter

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 - Flutter

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 - Flutter

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 - Flutter

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 - Flutter

Uninstall Android Studio...

Delete folder $/Program Files/Android

Install Android studio...

$flutter doctor

Solution 16 - Flutter

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 - Flutter

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 - Flutter

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 .

Solution 19 - Flutter

enter image description here

I was getting this error when I run flutter doctor.

Solution:

  • Go to the file "java" following the path where Error is shown.
  • Then right click on the file and go to Properties.
  • Then Go to permissions and Check the box "Allow executing file as program".
  • Finally, run flutter doctor to see No issues found!.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionshariful hasnineView Question on Stackoverflow
Solution 1 - FlutterNalawala MurtuzaView Answer on Stackoverflow
Solution 2 - FlutterBabaVarmaView Answer on Stackoverflow
Solution 3 - FlutterMohammed Salim Al-OthmanView Answer on Stackoverflow
Solution 4 - FlutterBonny JamesView Answer on Stackoverflow
Solution 5 - FlutterAndre SampaioView Answer on Stackoverflow
Solution 6 - FlutterJake WoodruffView Answer on Stackoverflow
Solution 7 - FlutterMd omer arafatView Answer on Stackoverflow
Solution 8 - FlutterZainView Answer on Stackoverflow
Solution 9 - FluttersamridhguptaView Answer on Stackoverflow
Solution 10 - FlutterLeaning MasterView Answer on Stackoverflow
Solution 11 - FlutterYerkebulan GazizView Answer on Stackoverflow
Solution 12 - FlutterHồ Duy Quốc BảoView Answer on Stackoverflow
Solution 13 - FlutterEwaldView Answer on Stackoverflow
Solution 14 - FlutterpedrociarliniView Answer on Stackoverflow
Solution 15 - FlutterYogesh AlaiView Answer on Stackoverflow
Solution 16 - FlutterAbhi RView Answer on Stackoverflow
Solution 17 - FlutterCarlos Fernando Arellano CasalView Answer on Stackoverflow
Solution 18 - FlutterDivya MadhamshettyView Answer on Stackoverflow
Solution 19 - FlutterYash DoshiView Answer on Stackoverflow