How can I solve this ? help newbie here

Launching lib\main.dart on AOSP on IA Emulator in debug mode…
Running Gradle task ‘assembleDebug’…

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:compileDebugKotlin’.

Kotlin could not find the required JDK tools in the Java installation ‘C:\Program Files (x86)\Java\jre1.8.0_301’ used by Gradle. Make sure Gradle is running on a JDK, not JRE.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1

Yeah I have the same issue too, please share if you get the solution

You probably have your JAVA_HOME pointing to the jre instead of the jdk. Download the Java JDK and edit your Environment Variables so gradle can find your installed JDK.

The error basically tells you exactly that…

@Blocky can u help me with this error?

FAILURE: Build failed with an exception.

  • Where:
    Initialization script ‘C:\Users\susha\AppData\Local\Temp\test_main__.gradle’ line: 21
  • What went wrong:
    A problem occurred configuring project ‘:app’.

Could not create task ‘:app:test.main()’.
SourceSet with name ‘main’ not found.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • Get more help at https://help.gradle.org

BUILD FAILED in 480ms

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface
15:08:14: Task execution finished ‘test.main()’.