Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to run the default Flutter program and I get the following error.

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.7/userguide/gradle_daemon.html
Process command line: C:\Program Files\Android\Android Studio\jre\bin\java.exe -Xmx1536M -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -cp C:\Users\Salma\.gradle\wrapper\dists\gradle-6.7-all\cuy9mc7upwgwgeb72wkcrupxe\gradle-6.7\lib\gradle-launcher-6.7.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.7
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
java/lang/ClassNotFoundException: error in opening JAR file C:\Program Files\Android\Android Studio\jre\jre\lib\rt.jar


* 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
Exception: Gradle task assembleDebug failed with exit code 1


What I have tried:

1. Downloaded Java and set the path.
> flutter doctor : Android ToolChain: X Java version not found
> Gives the same error
> removed it when it gave the same error
2. changed gradle.properties
org.gradle.jvmargs=-Xmx1536M // tried 512 & 1024

3. Uninstalled Android Studio and reinstalled again.
4. VS Code give the same error
5. I read in Android Studio 4.1 - Error Loading Studio (JAVA_HOME & JVM) - Stack Overflow[^]
to set the JAVA_HOME variable to C:\Program Files\Android\Android Studio\jre
and still the same error
Posted
Updated 27-Mar-21 5:41am
Comments
Richard MacCutchan 27-Mar-21 12:04pm    
The Java runtime for Android is slightly different from the one released for general use. You need to install the runtime components from Android Studio to get the correct version.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900