Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

flutter doctor cannot find the Java that comes with Android Studio

ErrorUnable to find bundled Java version.

Short answer

Flutter looks for the Java inside Android Studio first, then JAVA_HOME, then any java on PATH. The message means that search came up empty or hit a broken path. Reinstall or update Android Studio, fix JAVA_HOME if it is set, or tell Flutter the JDK with flutter config --jdk-dir.

  • Applies to Flutter 3.3x stable, Android Studio current stable, JDK 17 and 21, macOS 26, Windows 11, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run the verbose doctor and read the Java line of the Android toolchain section. It prints which Java Flutter picked, or says none was found.

    flutter doctor -v
  2. 2Match what you see, then jump to its fix

    1. 1No Android Studio section in flutter doctor, or it lists Android Studio without a Java pathAndroid Studio is missing or its bundled runtime is goneFix
    2. 2Only seen when Android Studio is not installed, or after JAVA_HOME was changedJAVA_HOME points to a folder that is not a JDKFix
    3. 3Several JDKs are installed and Flutter picks the wrong one or noneFlutter should use a JDK you choose, not search for oneFix

What does the error look like?

  • Unable to find bundled Java version.

Cause 1 of 3

Android Studio is missing or its bundled runtime is gone

1Check

Android Studio ships a JDK called the JetBrains Runtime in its jbr folder, and Flutter uses it by default. A partial update, a moved app or a removed folder leaves nothing to find.

ls "/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java"
# Linux: ls <android-studio-folder>/jbr/bin/java

2Fix

Install or update Android Studio from the official download so the jbr folder is back, then run the doctor again.

flutter doctor -v

3Verify

The Android toolchain section shows a Java binary path and no warning.

flutter doctor

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 3

JAVA_HOME points to a folder that is not a JDK

1Check

Without Android Studio, Flutter relies on JAVA_HOME, and uses the java on PATH only when it is unset. A stale or typo path breaks the search.

echo $JAVA_HOME
"$JAVA_HOME/bin/java" -version

2Fix

Point JAVA_HOME at the home folder of a real JDK, or unset it. On macOS the java_home helper lists the installed ones.

/usr/libexec/java_home -V
export JAVA_HOME=$(/usr/libexec/java_home -v 17)

3Verify

The doctor reports the same Java path.

flutter doctor -v | grep -i java

Confirmed by docs.flutter.dev

Did this fix it?

Cause 3 of 3

Flutter should use a JDK you choose, not search for one

1Check

Flutter can be given the Java for all projects. The path is the JDK home folder, the one that contains bin/java.

flutter config

2Fix

Set the JDK once in Flutter's config.

flutter config --jdk-dir=/opt/homebrew/Cellar/openjdk@17/17.0.13/libexec/openjdk.jdk/Contents/Home

3Verify

flutter doctor -v prints the path you configured.

flutter doctor -v

Confirmed by docs.flutter.dev

Did this fix it?

How do I stop it coming back?

  • Update Android Studio through its own updater instead of copying the app between folders.
  • Keep one JDK for Android work and set it with flutter config --jdk-dir.
  • Run flutter doctor -v after each Android Studio or JDK upgrade.
  • Do not leave an old JAVA_HOME export in shell profiles after uninstalling a JDK.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Flutter's Android build stops: JAVA_HOME is not set

ERROR: JAVA_HOME is set to an invalid directory

The Gradle wrapper script needs a Java runtime and looks in two places: the JAVA_HOME variable, then a java command on PATH.

3 causes, each with a fix

Mobile apps

A phone is plugged in over USB but Android Studio and adb do not list it

adb devices prints List of devices attached with nothing below it

adb lists a phone only when four things hold: USB debugging is on, you accepted the computer's RSA key on the phone, the computer has a driver or udev rule for the device, and the cable carries data to a running adb server.

6 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.