Error running Flutter Application - main class

I am currently trying to run my flutter application using android studios and I get this error

Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
Error: Could not find or load main class
Caused by: java.lang.ClassNotFoundException:
Could not write standard input to Gradle Worker Daemon 3. The pipe is being closed
	at java.base/ Method)
	at java.base/
	at java.base/
	at java.base/
	at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(
	at org.gradle.internal.concurrent.ManagedExecutorImpl$
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gradle:compileGroovy'.
> Failed to run Gradle Worker Daemon
   > Process 'Gradle Worker Daemon 3' finished with non-zero exit value 1

* 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

Error: Gradle task assembleDebug failed with exit code 1

I have even tried to make a brand new flutter project and I get the above error as well, right now it says Daemon 3 but its says Daemon 1 before

I am using a Gradle Wrapper

I have the Flutter SDK, Dart SDK setup and my Flutter Doctor says everything is ok