Flutter 3.24.2 新建项目提示 The configured version of Java detected may conflict with the Gradle version

发布于 1周前 作者 itying888 最后一次编辑是 5天前 来自 分享

Flutter环境已经搭建成功了,但是新建项目的时候提示jdk相关的错误 The configured version of Java detected may conflict with the Gradle version in your new Flutter app.

The configured version of Java detected may conflict with the Gradle version in your new Flutter app.

[RECOMMENDED] If so, to keep the default Gradle version 8.3, make
sure to download a compatible Java version
(Java 17 <= compatible Java version < Java 21).
You may configure this compatible Java version by running:
`flutter config --jdk-dir=<JDK_DIRECTORY>`
Note that this is a global configuration for Flutter.


Alternatively, to continue using your configured Java version, update the Gradle
version specified in the following file to a compatible Gradle version (compatible Gradle version range: 8.7 - 8.7):
D:\flutter_demos\flutter_demo03\android/gradle/wrapper/gradle-wrapper.properties

You may also update the Gradle version used by running
`./gradlew wrapper --gradle-version=<COMPATIBLE_GRADLE_VERSION>`.

Flutter 3.24.2 新建项目提示 The configured version of Java detected may conflict with the Android Gradle Plugin

解决办法如下, --jdk-dir后面的参数是你jdk的目录

flutter config --jdk-dir "C:\Program Files\Java\jdk-19"

按照提示使用flutter config配置一下 --jdk-dir就可以了

回到顶部