3

I have encountered this error when trying to run any Flutter Application be it a brand new project or a pre-existing one

Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain
Could not write standard input to Gradle Worker Daemon 3.
java.io.IOException: The pipe is being closed
    at java.base/java.io.FileOutputStream.writeBytes(Native Method)
    at java.base/java.io.FileOutputStream.write(FileOutputStream.java:349)
    at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
    at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
    at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
    at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)

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 https://help.gradle.org

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

I have done the following and still get the above error:

  1. Uninstalled the Flutter SDK and related plugins.
  2. Reinstalled the Flutter SDK, ensuring it was installed directly under the C:\ directory.
  3. Reinstalled Android Studio.
  4. Ran 'flutter doctor', which reported no issues (see screenshot attached) Flutter Doctor

I would just like to run any Flutter application

2

1 Answer 1

0

This error may appear in the windows system after updating the java version to a newer one. In System Variables, even after updating the java version and deleting all files of the previous version, the path will still point to non-existent files of the old version. Read more here

Sign up to request clarification or add additional context in comments.

3 Comments

It seems that the topic related to the reference you've given is not associated with the topic occurring from the question you've currently answered. The reference you've shared is all about JRE6, which is a very outdated version of Java Runtime Environment (JRE).
I had exactly this error. Flutter accessed the System Variable java which was deleted. At the same time, Flutter Doctor did not found any problems, because the version of java built into the Android Studio software package was correct. But when trying to run the application, the System Variable java has a higher value than the version of java built into the Android Studio software package!
As far as I know, Android Studio has own Java package installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.