flutter doctor cannot find the Java that comes with Android Studio
Unable 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.
Fix it fast
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 -v2Match what you see, then jump to its fix
- 1
No 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
Only seen when Android Studio is not installed, or after JAVA_HOME was changedJAVA_HOME points to a folder that is not a JDKFix - 3
Several JDKs are installed and Flutter picks the wrong one or noneFlutter should use a JDK you choose, not search for oneFix
- 1
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/java2Fix
Install or update Android Studio from the official download so the jbr folder is back, then run the doctor again.
flutter doctor -v3Verify
The Android toolchain section shows a Java binary path and no warning.
flutter doctorConfirmed by raw.githubusercontent.com
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" -version2Fix
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 javaConfirmed by docs.flutter.dev
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 config2Fix
Set the JDK once in Flutter's config.
flutter config --jdk-dir=/opt/homebrew/Cellar/openjdk@17/17.0.13/libexec/openjdk.jdk/Contents/Home3Verify
flutter doctor -v prints the path you configured.
flutter doctor -vConfirmed by docs.flutter.dev
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
Related fixes
Mobile apps
flutter doctor says the Android cmdline-tools component is missing
Android license status unknown.
Flutter checks for a cmdline-tools folder inside the Android SDK it found, and stops the Android checks when that folder is absent.
6 causes, each with a fixMobile 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 fixMobile apps
flutter run hangs for minutes on Running Gradle task 'assembleDebug'
Downloading https://services.gradle.org/distributions/gradle-8.14-all.zip
That line only says Gradle started; the wait is inside Gradle.
3 causes, each with a fixMobile apps
Flutter Android build fails with Unsupported class file major version
Unsupported class file major version 65
The number is the Java version that tried to read a file: 61 is Java 17, 65 is Java 21.
3 causes, each with a fixMobile apps
Flutter release build cannot open the keystore: HmacPBESHA256 not available
Algorithm HmacPBESHA256 not available
The keystore is a PKCS12 file protected by a newer algorithm than the Java that is reading it understands.
3 causes, each with a fixMobile 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