Eclipse 与 Android sdk,错误:Java 堆空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16741680/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:36:15  来源:igfitidea点击:

eclipse with Android sdk, ERROR: Java heap space

javaandroideclipseconfiguration

提问by zvzej

So lately I'm having a problem while working in my apps inside eclipse the next message shows up while working with xml files:

所以最近我在 eclipse 中使用我的应用程序时遇到了问题,在使用 xml 文件时会显示下一条消息:

ERROR: 'Java heap space'

I have read an try increasing inside the eclipse.ini file the:

我已经阅读了在 eclipse.ini 文件中增加的尝试:

-vmargs
-Xmx40m
-Xmx512m

to:

到:

-vmargs
-Xmx512m
-Xmx1024m 

but it will work for a while than after and hour or so it will give me the same error, I'm working in a MacBook air with 4gb ram. I have Eclipse SDK Version: 3.7.2 Build id: M20120208-0800 and I just updated it, so I don't know if that is why is acting up this way, this is how my eclipse.ini looks right now:

但它会工作一段时间,而不是一小时左右,它会给我同样的错误,我正在使用 4GB 内存的 MacBook air。我有 Eclipse SDK 版本:3.7.2 构建 ID:M20120208-0800,我刚刚更新了它,所以我不知道这是否是为什么会这样,这就是我的 eclipse.ini 现在的样子:

-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xmx512m
-Xmx1024m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

what else can I do to fix this? any help is really appreciated. thanks in advance.

我还能做些什么来解决这个问题?任何帮助都非常感谢。提前致谢。

回答by Raghunandan

Try this

尝试这个

In Run->Run Configuration find the Name of the class you have been running, select it, click the Arguments tab then add:

在 Run->Run Configuration 中找到您一直在运行的类的名称,选择它,单击 Arguments 选项卡,然后添加:

  -Xms512M -Xmx1524M

to the VM Arguments section

到 VM 参数部分

Few useful links

几个有用的链接

What are the best JVM settings for Eclipse?

Eclipse 的最佳 JVM 设置是什么?

Error "java heap size" in Eclipse Android?

Eclipse Android 中的“java 堆大小”错误?

Edit:

编辑:

Your eclipse.ini settings will take effect only if you change following:

您的 eclipse.ini 设置只有在您更改以下内容时才会生效:

Run -> External Tools -> External Tool

运行 -> 外部工具 -> 外部工具

Configurations. go to configuration that u use, under jre tab -select option

配置。转到您使用的配置,在 jre tab -select 选项下

Run in same JRE in workspace.

在工作区中的同一个 JRE 中运行。