Home  >  Article  >  Java  >  Why Is Flutter Showing an \'Unable to Find Bundled Java Version\' Error, and How Can I Fix It?

Why Is Flutter Showing an \'Unable to Find Bundled Java Version\' Error, and How Can I Fix It?

Barbara Streisand
Barbara StreisandOriginal
2024-11-21 07:23:10726browse

Why Is Flutter Showing an

Troubleshooting "Unable to find bundled Java version" Error in Flutter

When encountering the "Unable to find bundled Java version" error while using the flutter doctor command, it signifies a missing bundled Java version with Flutter. This often occurs after installing a newer version of Android Studio. To resolve this issue, follow the appropriate steps based on your operating system:

For Windows Users

Verify that your Java version is up-to-date and set correctly in your system's environment variables. To do this:

  1. Open Command Prompt and enter "java -version" to check your current Java version.
  2. Set the JAVA_HOME environment variable to point to the installed Java directory, typically C:Program FilesJavajdk-version.
  3. Add the bin directory of the JDK to your system's PATH environment variable.
  4. Restart your terminal and run "flutter doctor" again.

For Mac Users

For Mac users using JetBrains Toolbox:

  1. Set the JAVA_HOME environment variable to point to the JetBrains Runtime directory.
  2. Change username to your macOS username and run the following commands:
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
  1. If the issue persists, try the following workaround:
cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre

For other Mac users:

  1. Open Android Studio installer.
  2. Open "Configure."
  3. Scroll down to "Android SDK location" & "JDK location."
  4. Enter the directory path of the JDK.
  5. Install Android Studio.
  6. Run "flutter doctor" again.

The above is the detailed content of Why Is Flutter Showing an \'Unable to Find Bundled Java Version\' Error, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn