【问题标题】:Cannot run Android Studio - Invalid ReservedCodeCacheSize无法运行 Android Studio - 无效的 ReservedCodeCacheSize
【发布时间】:2021-06-08 15:24:37
【问题描述】:

我下载了适用于 Ubuntu 的 Android Studio,每次尝试从 bin 文件夹中运行 ./studio.sh 来运行它时,都会收到以下错误消息:

Invalid ReservedCodeCacheSize=4000M. Must be at most 2048M.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

这是我的 studio.vmoptions 和 studio64.vmoptions 文件供参考

studio.vmoptions

-server
-Xms256m
-Xmx768m
-XX:ReservedCodeCacheSize=240m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Djna.nosys=true
-Djna.boot.library.path=
-Didea.vendor.name=Google
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Dsun.tools.attach.tmp.only=true

studio64.vmoptions

-Xms256m
-Xmx1280m
-XX:ReservedCodeCacheSize=240m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Djna.nosys=true
-Djna.boot.library.path=
-Didea.vendor.name=Google
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Dsun.tools.attach.tmp.only=true

我目前安装了 openjdk-8-jdk 和 openjdk-11-jdk

如果有人可以帮助我,我将不胜感激!

【问题讨论】:

  • shell 脚本是否为 JVM 指定了任何参数?我建议运行sh -x ./studio.sh 并检查输出。如果您想添加信息,请edit您的问题,不要为此目的使用 cmets。

标签: linux android-studio ubuntu jvm


【解决方案1】:

我修复了它,我基本上是在编辑错误的 studio64.vmoptions 文件,我在~/.config/Google/AndroidStudio4.2 中编辑了那个,之后一切正常

【讨论】:

    猜你喜欢
    • 2016-09-20
    • 1970-01-01
    • 2022-12-17
    • 2019-06-14
    • 1970-01-01
    • 1970-01-01
    • 2016-09-13
    • 2020-08-17
    • 2019-01-30
    相关资源
    最近更新 更多