我正在尝试使用 Android Studio 运行我新创建的 Flutter 应用程序,但我对此还很陌生。我目前正在使用最新版本“Ladybug”,并且我还尝试安装不同的 Java 版本。但是,我无法确定导致问题的确切问题。
当触发“flutter doctor -v”时
C:\flutter\src\flutter\bin>flutter doctor -v
[√] Flutter (Channel stable, 3.27.0, on Microsoft Windows [Version 10.0.26100.2605], locale en-US)
• Flutter version 3.27.0 on channel stable at C:\flutter\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 8495dee1fd (8 days ago), 2024-12-10 14:23:39 -0800
• Engine revision 83bacfc525
• Dart version 3.6.0
• DevTools version 2.40.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0-rc1)
• Android SDK at C:\Users\Gayashan Pathirana\AppData\Local\Android\Sdk
• Platform android-31, build-tools 36.0.0-rc1
• Java binary at: <C:\Program Files\Java\jdk-17>\bin\java
X Cannot execute <C:\Program Files\Java\jdk-17>\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 Community 2022 17.11.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.11.35303.130
• Windows 10 SDK version 10.0.22621.0
[√] 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)
[√] IntelliJ IDEA Community Edition (version 2022.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.2
• 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
[√] VS Code (version 1.96.0)
• VS Code at C:\Users\Gayashan Pathirana\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.102.0
[√] Connected device (4 available)
• RMX2180 (mobile) • adb-6PMFVGOFA6I74TC6-WDe0Xb._adb-tls-connect._tcp • android-arm64 • Android 11 (API 30)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows
[Version 10.0.26100.2605]
• Chrome (web) • chrome • web-javascript • Google Chrome
131.0.6778.140
• Edge (web) • edge • web-javascript • Microsoft Edge
131.0.2903.99
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
我怀疑您将 PATH 正确设置为
C:\Program Files\Java\jdk-17\bin
但是,仍然在你的环境变量中,
您必须将 JAVA_HOME 设置为
C:\Program Files\Java\jdk-17
而不是 C:\Program Files\Java\jdk-17\bin
如有必要,通过 Android Studio 中的“文件”>“无效缓存...”执行无效缓存。
然后再次重建您的应用程序,或重试
flutter doctor -v
希望对你有帮助!