admin管理员组

文章数量:1122846

enter code hereI am still a beginner with flutter and I badly need some help on how to resolve some issues. Whenever I try to run the app, the said error appears:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_172;

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Running Gradle task 'assembleDebug'...                              66ms
Error: Gradle task assembleDebug failed with exit code 1

I tried adding the path "C:\Program Files\Java\jdk-23\bin" to the JAVA_HOME because that's what I saw in one tutorial; still, it doesn't work.

I also tried flutter doctor, and apparently, there are some problems.

 PS D:\flutter_projects\adv_basics> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.1, on Microsoft Windows [Version 10.0.22631.4602], locale    en-PH)   
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    X Cannot execute C:\Program Files\Java\jdk1.8.0_172;\bin\java to determine the version
[X] Chrome - develop for the web (Cannot find Chrome executable at
    .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at /.
      Please install the "Desktop development with C++" workload, including all of its
      default components
[!] Android Studio (version 2024.2)
    X Unable to find bundled Java version.
[√] Connected device (2 available)
[√] Network resources

! Doctor found issues in 4 categories.

I don't know what to do anymore. I really need to fix this already for my school project :'(. I would really appreciate it if you could offer some help

本文标签: flutterHow to fix Error Gradle task assembleDebug failed with exit code 1eStack Overflow