在Android Studio中出现了无效的最大堆大小错误。

huangapple go评论108阅读模式
英文:

Invalid maximum heap size error in Android Studio

问题

我在Ubuntu(Linux)中使用最新版本的Android Studio。在更改了vm选项后,我无法运行Android Studio。启动Android Studio时出现以下错误:

  1. 无效的最大堆大小:-Xmx4096m <------ 将此增加到大部分RAM
  2. 错误:无法创建Java虚拟机。
  3. 错误:发生了致命异常。程序将退出。

这是我的studio64.vmoptions文件:

  1. -Xms256m
  2. -Xmx1280m
  3. -XX:ReservedCodeCacheSize=240m
  4. -XX:+UseConcMarkSweepGC
  5. -XX:SoftRefLRUPolicyMSPerMB=50
  6. -XX:CICompilerCount=2
  7. -Dsun.io.useCanonPrefixCache=false
  8. -Djdk.http.auth.tunneling.disabledSchemes=""
  9. -Djdk.attach.allowAttachSelf=true
  10. -Dkotlinx.coroutines.debug=off
  11. -Djdk.module.illegalAccess.silent=true
  12. -Djna.nosys=true
  13. -Djna.boot.library.path=
  14. -Didea.vendor.name=Google
  15. -Dawt.useSystemAAFontSettings=lcd
  16. -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
  17. -Dsun.tools.attach.tmp.only=true

如何解决?我还尝试删除了studio64.vmoptions和studio.vmoptions文件,但问题仍然存在。

英文:

I'm using latest version of android studio in Ubuntu(linux). After make changes to vm options. I'm unable to run android studio.
I'm getting this error while starting android studio -

  1. Invalid maximum heap size: -Xmx4096m # <------ increase this to most of your RAM
  2. Error: Could not create the Java Virtual Machine.
  3. Error: A fatal exception has occurred. Program will exit.

This is my studio64.vmoptions file :

  1. -Xms256m
  2. -Xmx1280m
  3. -XX:ReservedCodeCacheSize=240m
  4. -XX:+UseConcMarkSweepGC
  5. -XX:SoftRefLRUPolicyMSPerMB=50
  6. -XX:CICompilerCount=2
  7. -Dsun.io.useCanonPrefixCache=false
  8. -Djdk.http.auth.tunneling.disabledSchemes=""
  9. -Djdk.attach.allowAttachSelf=true
  10. -Dkotlinx.coroutines.debug=off
  11. -Djdk.module.illegalAccess.silent=true
  12. -Djna.nosys=true
  13. -Djna.boot.library.path=
  14. -Didea.vendor.name=Google
  15. -Dawt.useSystemAAFontSettings=lcd
  16. -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
  17. -Dsun.tools.attach.tmp.only=true

How to fix it? I'm Also tried to delete studio64.vmoptions and studio.vmoptions files. But issue still going on.

答案1

得分: 4

"Thank you so much for myself". 我在2小时内搞定了。在谷歌上搜索了很多,但没有找到适合我的方法。

这是唯一的解决方法。

注意:我使用的是带有4GB内存和64位的Ubuntu

步骤1: 打开文件管理器 > 显示隐藏文件

步骤2: 进入文件夹 > .config/Google/AndroidStudio-versionName

步骤3: 删除studio64.vmoptions文件

步骤4: 重新启动Android Studio

英文:

Thank you so much for myself. I got it in 2 hours. After searching too much on google, found nothing that works for me.

This is the only way to solve it.

Note : I'm using Ubuntu with 4g ram 64bit

Step 1. Go to file manager > show hidden files

Step 2. Go to folder > .config/Google/AndroidStudio-versionName

Step 3. Delete studio64.vmoptions file

Step 4. Restart Android Studio

huangapple
  • 本文由 发表于 2020年10月24日 12:18:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/64509926.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定