我的代码中没有错误。 因此,当代码运行时,它会出现在调试控制台中:
launching lib\main.dart on AOSP on IA Emulator in debug mode...
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
然后停止启动
我打开了命令提示符,然后在其中写了“ flutter doctor”,然后 出现在我身上
C:\Users\Dell>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18362.53], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
X No Java Development Kit (JDK) found; You must have the environment variable JAVA_HOME set and
the java binary in
your PATH. You can download the JDK from https://www.oracle.com/technetwork/java/javase/downloads/.
[!] Android Studio (not installed)
[√] VS Code (version 1.48.2)
[√] Connected device (1 available)
! Doctor found issues in 2 categories.
然后我在命令提示符下写了 “颤振升级--force” 然后更新并确保我写了“ flutter upgrade”然后出现在我身上
Flutter is already up to date on channel stable
Flutter 1.20.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision bbfbf1770c (3 weeks ago) • 2020-08-13 08:33:09 -0700
Engine • revision 9d5b21729f
Tools • Dart 2.9.1
然后我返回了vscode来运行代码,但对我来说出现了相同的错误
launching lib\main.dart on AOSP on IA Emulator in debug mode...
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
我不知道该怎么办