我的flutter doctor无法识别JAVA_HOME路径
我在环境变量中设置 JAVA_HOME 路径:C:\Program Files\Java\jdk-23
我的
flutter doctor -v
:
[✓] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22621.4317], locale en-US)
• Flutter version 3.24.3 on channel stable at C:\Users\Admin\dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (7 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\Admin\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home\bin\java
✗ Cannot execute /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home\bin\java to determine the version
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✗] Visual Studio - develop Windows apps
✗ Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[✓] Android Studio (version 2024.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.4317]
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.71
• Edge (web) • edge • web-javascript • Microsoft Edge 130.0.2849.56
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
我使用Windows,它没有这个路径(/Library/Java/JavaVirtualMachines/...)。
我改变了我的jdk版本 也什么都没有
您可以在 JAVA_HOME 中尝试您的 java sdk 的 bin 路径,例如 “C:\Program Files\Java\jdk-23 中”
或
在用户变量中的JAVA_HOME中设置路径“C:\Program Files\Android\Android Studio\jbr”。然后重新启动系统并尝试。