Android Studio的JVM编译选项-XX:MaxPermSize高版本JDK抛错

Android Studio的JVM编译选项-XX:MaxPermSize高版本JDK抛错

 

错误日志如下:

-----------------------
Unrecognized VM option 'MaxPermSize=4096m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

-----------------------
Check the JVM arguments defined for the gradle process in:
 - gradle.properties in project root directory

 

原因是Java VM option的MaxPermSize选项,存在于Java 11 ~ Java 17,在Java 17以后的新/高版Java,MaxPermSize不再支持且被删除。详情见 The java Commandhttps://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#removed-java-options

-XX:MaxPermSize=size

Sets the maximum permanent generation space size (in bytes). This option was deprecated in JDK 8 and superseded by the -XX:MaxMetaspaceSize option.

-XX:PermSize=size

Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it's exceeded. This option was deprecated in JDK 8 and superseded by the -XX:MetaspaceSize option.

 

因此,Java 17之后,不要在Android Studio的gradle.properties配置MaxPermSize选项

如果仍要配置这一项,请用:

-XX:MaxMetaspaceSize

替代。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhangphil

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值