341

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) on Windows 10.

I don't have any older versions of Android Studio on my computer.

2
  • 1
    This GitHub-issue response solved it for me: github.com/flutter/flutter/issues/… Commented Feb 17, 2023 at 20:18
  • Go to C:\Program Files\Android\Android Studio, then copy the contents of jbr and paste the contents into the jre folder. Run flutter doctor again and it will solve the problem. Commented Jan 4 at 6:24

37 Answers 37

428

Right approach

In short and simple, the best approach to fix this issue is by upgrading your Android Studio and Flutter to latest versions, in order to avoid any potential issues (e.g. patching) in future.

Original answer

For those having these issues with the latest Android Studio - Electric Eel version, and other canaries and preview releases, note that the bundled jre directory in the Android Studio installation folder is now renamed to jbr

To resolve this, just create a sym link jre -> jbr and Flutter won't complain.

On Linux

cd ~/android-studio/ && ln -s jbr jre

Windows (check installation folder)

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

or

New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr

Mac OS

cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre

Note that if you are running a preview release, and depending on your OS, the default installation directory might be different, e.g. on Linux it would be

~/android-studio-preview/

In either case, you can check the installation directory by running

flutter doctor -v

Also, in case if you run with permissions issues, you can try running the command with admin privileges, depending on your OS.

For example on Mac/Linux, you can just run the same command with sudo and it should work, additionally on Mac, you'll have to configure the Disk Access permissions, depends on your version, but most probably can be found under:

Settings - Privacy & Security - Full Disk Access - Terminal

Sign up to request clarification or add additional context in comments.

20 Comments

Is there any source or comment on the directory name change by the dev team? Been pulling my hair for the last hour reinstalling and browsing the directories trying to figure it out what was wrong, thanks
bro, operation not permitted on mac to create a symlink between jbr and jre, please help
@VanditShah give the terminal full disk access at settings>privacy & security>full disk access>terminal and then call the command with sudo
On Windows, flutter doctor was throwing this error with latest Android Studio i.e. Electric Eel | 2022.1.1. However for me, jre folder already existed under C:\Program Files\Android\Android Studio which contained just one file \jre\bin\.marker. I renamed the existing jre folder into jre_old and afterwards created the symbolic link through below command. problem fixed ! cd C:\Program Files\Android\Android Studio mklink /D "jre" "jbr"
This helped me a lot of time. PS. for those who are getting "Access Denied" error on windows by running mklink /D "jre" "jbr", just run CMD as Administrator.
|
422

For Mac Users:

Set the JAVA_HOME path by following this article and then apply the following commands:

For the JetBrains Runtime "Android Studio Electric Eel"

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

Then go to the Finder and search for Android Studio:

  1. Right click -> Show Package Contents
  2. Open the contents folder, then create new folder called jre
  3. Copy the contents of the JetBrainsRuntime folder and paste it into the jre folder

flutter doctor -v should work now!

Other versions

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

Then you can run flutter doctor -v


For Mac users who are using the JetBrains Toolbox:

Set the JAVA_HOME path following the article.

After that, change username to your macOS username and run:

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

If you're still facing the issue, you can try this workaround:

cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre

13 Comments

I followed everything except that I couldn't find "jre" folder, it was "jbr" for me. issue was fixed when I renamed the folder to "jre"
@Texv instead of rename, create a link by "ln -s jbr jre", otherwise "Android Studio Preview" can not be launched.
'sudo ln -s jbr jre' was giving me 'ln: jre: Operation not permitted' so I just copied the jbr folder and renamed it jre
If your not permitted go here osxdaily.com/2018/10/09/…
God bless the internet... Attention for anyone using newer versions of Mac btw, even 'sudo ln -s jbr jre' will fail because there is a new security setting where you actually have to go in and grant terminal permission to edit other applications.
|
222

For Windows users:

Go to C:\Program Files\Android\Android Studio, then copy the contents of jbr and paste the contents into the jre folder.

Run flutter doctor again and it will solve the problem.

(I'm running Android studio 2022.1)

4 Comments

Delete the jre folder and change the environment variable to jbr. It works for me even the flutter doctor complains.
im using android studio 2022.1.1 and this answer works for me.
This breaks Android Studio patching
When I try to install the Android Studio patch I get a fatal error saying that jre/bin/.marker file was not found. To resolve, I removed the symbolic link, created the jre/bin/.marker folders and empty file. This allows installation to complete. Then I applied the symbolic link fix again to fix flutter. Not ideal... This is on Windows 10
104

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.

2 Comments

The older one is one with only the JRE folder like @Neail pointed it out. The one with the smaller number
Ah... I installed NEWER version of Android Studio in a new/different directory... c:/dev/tools/AndroidStudio. The older version of Android was uninstalled, but there were some files/folders remaining in C:\Program Files\Android\Android Studio\jbr folder. I deleted the entire (old/previous version) Android Studio folder. Re-ran flutter doctor -v. All good.
58

For Mac Users

Make sure you have installed java and set the java_home path, you can use homebrew for that.

If you installed Android Studio Electric Eel Follow the following step

  1. Go to your Applications folder.
  2. Search for Android Studio.app. (flutter doctor -v also has an Android Studio entry which will show you the app location)
  3. Right click and select Show Package Content.
  4. Navigate into the Content Folder that opens.
  5. Use your terminal to cd into that folder and then enter the command below and everything should be solved
ln -s jbr jre

The command above creates a symbolic link

The symbolic link also works on Ubuntu.

6 Comments

Why this this happen with Electric Eel suddenly? Never had this problem before, just recently.
@CsabaToth well I think Android Studio was built on JetBrains IntelliJ IDEA software, which uses its own version of openjdk called Jetbrains runtime(jbr). So I think in the new version of android studio, maybe they might have switched to using Jetbrains jrb.
I used brew to install Android Studio. cd /Applications/Android\ Studio.app/Contents/ && ln -s jbr jre
For users who use toolbox, flutter doctor -v will show you the Android Studio app location. Then do the above.
You have to add permission privacy setting for terminal to execute ln. osxdaily.com/2018/10/09/…
|
35

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

Comments

27

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

2 Comments

cd: no such file or directory: /Applications/Android Studio Preview.app/Contents/jre
no jre folder in Android Studio Preview.app. I solved it and post my solution below for Android Studio Preview
26

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

1 Comment

Good solution. If it contains unnecessary folders not related to the necessary version, they should be deleted. Then the problem will be solved.
19

Go to Finder > Applications > Android Studio:

  1. Right click and click "Show package contents"
  2. Create a new folder called jre
  3. Copy the contents of the jbr folder and paste them into the jre folder

1 Comment

cool. happy to hear
18

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

2 Comments

make sure no spaces in the path of the directory
that worked for me, I am using windows os! Can anybody explain how it worked?
13

In latest version of Flutter for Mac, you won't find jre folder under /Applications/Android Studio.app/Contents

Therefore, you can start Terminal and run following commands to fix the issue:

cd /Applications/Android Studio.app/Contents

ln -s jbr jre (creates a symbolic link (shortcut) named jre pointing to jbr)

If you're on latest version of Mac, you might see error while trying to make changes under Applications folder using Terminal, resolve it by adding sudo, like this:

sudo ln -s jbr jre (runs the above command as admin, it will ask you for Mac password)

You might still see security alert, then you must go to System Settings > Privacy & Security > App Management and Terminal as in the list of apps allowed to make changes under Applications folder.

Comments

11

For Android Studio Preview

I already install

  • Android Studio Preview
  • JDK via Android Studio Preview
  • Xcode v12 on MacOS 10.15

Here is what I faced [!] Android Studio: Unable to find bundled Java version.

Solution:

  1. Find out JDK PATH. Check this
#check bash or zsh

$ echo $SHELL
/bin/bash

#return the path of java_home 
$ /usr/libexec/java_home

2.Add JAVA_HOME in .bash_profile for bash or .zshenv for zsh

$ nano ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
$ source ~/.bash_profile

3.Link JDK path to Android Studio Preview

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

# flutter doctor check if Contents/jre exist, link jbr with jre
$ ln -s jbr jre

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

4.[Optional] if you have Android Studio at the same time, you could follow @Nalawala Murtuza solution. It is permitted for Android Studio and Android Studio Preview at the same time during check from flutter doctor. Doesn't need to delete Android Studio Preview.

enter image description here

5.Use flutter doctor -v to check

Comments

9

For Windows Go To android studio directory (Default C:\Program Files\Android\Android Studio) remove jre folder run cmd as administrator

cd C:\Program Files\Android\Android Studio

mklink /D "jre" "jbr"

Comments

6

for Ubuntu 22.04 and android sturdio 2022.1.1

cd path/to/android-studio

Just copy jbr directory to jre directory

cp -r jbr/ jre

and it will work

enter image description here

3 Comments

I tried this and just get "cp: cannot create directory 'jre': Read-only file system". Tried as sudo too, but get the same thing. Did you have that too? How did you get around it?
my android installation is under $HOME directory because it is installed by Jetbrains toolbox app So a manual installation or using the toolbox could resolve your permission problem
Thanks. I had installed Android Studio with snap and that was why the error was coming up. Installing manually (download and extract etc) I was able to add a symlink no problem, but you could equally copy the folder per above too.
6

For MacOS users, follow this please:

  1. Open this path: /Applications/Android Studio.app/Contents/
  2. If there is no jre folder, then create it manually
  3. Copy all contents of jbr folder, and paste them into jre folder
  4. Go back to Terminal and run flutter doctor -v and the error should be cleared

Comments

6

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

Before:

flutter config --android-studio-dir D:\Android\Android Studio

enter image description here

After:

flutter config --android-studio-dir "D:\Android\Android Studio"

enter image description here

1 Comment

This answer would be much better if the text were expressed as text, not an image. Images are much harder to use than text, for many reasons.
5

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)

5 Comments

I have both the stable and the beta Android Studio installed, how did you change your Android Studio?
in Android Studio update your Preview channel to Stable.. developer.android.com/studio/preview/…
Thank you for the response but I need to use Beta for m1 mac support, will try once and see.
Unknown to what could be different for M1 macs.
Any fix for m1 mac?
4

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

2 Comments

I followed your instructions and nothing changed. I'm on an m1 MBP.
I am using Java 11, and I needed to make one small change to make it work. Currently, it is working when I modify your code like the following: ln -s /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents Contents
4

I faced the same issue, and I solved it by going to this path:

C:\Program Files\Android

you will find folders like this:

  • Android Studio1
  • Android Studio2
  • Android Studio3
  • Android Studio4

delete all of them and leave just the latest which in this case is "Android Studio4"

run flutter doctor again and it should work

Comments

3

If it's not related to JAVA_HOME path, then try the following:

  • go to path: C:\Users\Administrator\AppData\Local\Google and delete the old version of AndroidStudioXXX.X folder
  • now run flutter doctor again. it fixes mine.

Comments

2

For mac users

open andriod studio as follow - when you open android studio, it shows content. Open it as above enter image description here

then copy paste jbr to jre as follow above

enter image description here

java path will automatically set.

i have checked on Android Studio Iguana | 2023.2.1

Comments

2

I resolved this issue by removing an older version of Android Studio that was causing conflicts.

Steps to Fix:

  1. Navigate to the following directory:

C:\Program Files\Android 2. I noticed that two folders existed: Android Studio
Android Studio1

I deleted the older Android Studio folder, which resolved the issue.

It seems that Flutter was detecting the outdated version, leading to the Unable to find bundled Java version error.

Comments

1

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)

1 Comment

There are many versions out there. Which one did you go to?
1

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.

Comments

1

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

Comments

1

Adding an answer for 2025 that worked for me.

  1. enter image description here

  2. My Program Files had two AndroidStudio folders , because I updated from Android Studio itself.

    enter image description here

  3. Deleted "Android Studio"

  4. enter image description here

No More Errors.

Comments

0

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

Comments

0

If you are using Ubuntu and used JetBrains Toolbox then just do one thing: Go to the Android Studio directory /home/shahadat/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592 address path will look like this.

if you do not know how to find out the Android studio path from the JetBrains toolbox or anything else then type flutter doctor -v and then check Android Studio Section (Version 2022.2) - The version can vary.

Then just copy the jbr directory and rename the directory/folder as jre.

Now run flutter doctor -v

This works for me.

Comments

0

for windows :

1.run CMD as Administratormklink.

2.go to android studio path.

3.taype in cmd

mklink /D "jre" "jbr"

Comments

0

Rename the "jbr" file to "jre" within C:\Program Files\Android\Android Studio\jbr. Once done, open a new command prompt to check if the bundle error has been cleared, as illustrated in https://www.youtube.com/watch?v=u7q6MQNAsIc.

System in use - Windows

2 Comments

Android Studio does not open after i change the folder name.
Try restarting the system. At times windows doesn't seem to read the newly changed environment variables. If that doesn't work, try reinstalling android studio and repeat the same process. Also note, the java home variable you set will the latest if you download. Sometimes it might cause issues with your project settings. If you want more control over the java version i recommend you download an external jdk for your usecase. Its much more reliable.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.