Hi I am trying to build Android apk and I get the following errors when I run the shell script.
Could you suggest what I can do to resolve this please.
I have latest JAVA installed
xx.xxx@OEMBP01 app-android % java -version java version "17.0.1" 2021-10-19 LTS Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39) Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
Error I get is
Starting a Gradle Daemon (subsequent builds will be faster) 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/7.1.1/userguide/gradle_daemon.html Process command line: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=GB -Duser.language=en -Duser.variant -cp /Users/xx.xxx/.gradle/wrapper/dists/gradle-7.1.1-all/1wqbeia0d49252rmlcr6o8lbl/gradle-7.1.1/lib/gradle-launcher-7.1.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.1.1 Please read the following process output to find out more: ----------------------- Unrecognized VM option 'MaxPermSize=512m' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. * 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
Advertisement
Answer
You are using two JVM options that are no longer available in recent Java versions:
- The
MaxPermSize
option has been removed in Java 8 - The
UseConcMarkSweepGC
option was deprecated in Java 9
Both options were initially reported as a warning and now raise an actual error when trying to start the VM.
Unless you encounter specific issues, you should be able to rely on the current default values, so simply remove -XX:MaxPermSize=512m
and -XX:+UseConcMarkSweepGC
from your list of arguments (e.g. in your gradle.properties
file).