[Flutter environment configuration problem] Unable to find bundled Java version.

mistake:

When running "flutter doctor" , it reports "Unable to find bundled Java version." error

Operating environment:

System: win10 22H2 19045.2486

Android Studio Version: Android Studio Electric Eel 2022.1.1.19

Flutter version: 3.3.10

reason:

It seems that the new version of Android Studio "jre" folder does not have JDK related files. An error is reported when running the "flutter doctor" command.

Solution:

Just drop the JDK file into the "jre" folder of the Android Studio installation directory .

Note: The JDK version should not be too new! !

If the JDK version is too new, it will cause "Unsupported class file major version XX problem" in the subsequent compilation of the Flutter project. If this error occurs during compilation, just downgrade the JDK version in the "jre" folder.


Open the Project Structure of Android Studio

click

Select "Project Structure" from the pop-up menu

Download JDK (you can skip this step if you have downloaded JDK)

打开"Project Structure"后选择"SDK"并点击顶部的"+"。如图所示:

在弹出的菜单中选择"Download JDK"

JDK版本随意,但不建议用最新的,会影响flutter项目编译,我这里使用默认项,之后点击下载(记住下载路径)

打开JDK目录并将文件移动至AS的安装目录中的jre中

打开下载好的JDK的目录并复制里面的内容

找到AS的安装目录并打开"jre"文件夹。

JDK目录中复制到的文件粘贴至"jre"文件夹中。

重新运行"flutter doctor"命令

问题解决。

Guess you like

Origin blog.csdn.net/woshidanoob/article/details/128779709
Recommended