我在 Ubuntu(linux) 中使用最新版本的 android studio。更改虚拟机选项后。我无法运行 android studio。 我在启动 android studio 时遇到此错误 -
Invalid maximum heap size: -Xmx4096m # <------ increase this to most of your RAM
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
这是我的 studio64.vmoptions 文件:
-Xms256m
-Xmx1280m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-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 和 studio.vmoptions 文件。但问题仍然存在。
最佳答案
非常感谢你自己
。我2个小时就收到了在 Google 上搜索了太多之后,没有找到
对我有用的内容。
这是解决问题的唯一方法。
注意:我使用的是带有 4g ram 64 位的 Ubuntu
第 1 步。转到文件管理器 > 显示隐藏文件
第 2 步。转到文件夹 > .config/Google/AndroidStudio-versionName
步骤 3. 删除 studio64.vmoptions 文件
第 4 步。重新启动 Android Studio
关于java - Android Studio 中的最大堆大小无效错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64509926/