嗨,我正在嘗試構建 Android apk,但在運行 shell 腳本時出現以下錯誤。
你能建議我能做些什么來解決這個問題。
我安裝了最新的 JAVA
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)
我得到的錯誤是
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
uj5u.com熱心網友回復:
您使用的兩個 JVM 選項在最近的 Java 版本中不再可用:
- 該
MaxPermSize選項已在 Java 8 中洗掉 - 該
UseConcMarkSweepGC選項在 Java 9 中已棄用
這兩個選項最初都報告為警告,現在在嘗試啟動 VM 時引發實際錯誤。
除非您遇到特定問題,否則您應該能夠依賴當前的默認值,因此只需從您的引數串列中洗掉-XX:MaxPermSize=512m和-XX: UseConcMarkSweepGC(例如在您的gradle.properties檔案中)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/390022.html
標籤:爪哇 安卓 等级 虚拟机 android-build
