简体   繁体   English

无法在Eclipse中执行dex:GC开销限制

[英]Unable to execute dex: GC overhead limit exceeded in Eclipse

When I downloaded the Git project OsmAnd and went to compile it, Eclipse returned these errors: 当我下载Git项目OsmAnd并编译它时,Eclipse返回了以下错误:

[Dex Loader] Unable to execute dex: GC overhead limit exceeded
[OsmAnd]     Conversion to Dalvik format failed: 
             Unable to execute dex: GC overhead limit exceeded

Google and Stackoverflow said that I must change -Xms40m -Xmx384m in eclipse.ini . Google和Stackoverflow表示我必须在eclipse.ini更改-Xms40m -Xmx384m Conversion to Dalvik format failed: Unable to execute dex: Java heap space . 转换为Dalvik格式失败:无法执行dex:Java堆空间
I cleaned project and restarted Eclipse, but it did not help. 我清理了项目并重新启动了Eclipse,但它没有帮助。

I found this link: Tips for Android developer: “Conversion to Dalvik format failed: Unable to execute dex: null” But I do not know which .jar from my project to change the input in. If anyone can help, I can send the project to them. 我找到了这个链接: Android开发人员的提示:“转换为Dalvik格式失败:无法执行dex:null”但我不知道从我的项目中更改输入的.jar 。如果有人可以提供帮助,我可以发送向他们投射。

It can be fixed by changing the VM values in Eclipse.ini. 可以通过更改Eclipse.ini中的VM值来修复它。 Set the values to 512 and 1024 as below: 将值设置为512和1024,如下所示:

openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx1024m

The changed area in image 图像中更改的区域 在此输入图像描述

For me following steps worked 对我来说,遵循以下步骤

1) Open eclipse.ini file
2)changed
-Xms40m
-Xmx512m
to 
-Xms512m
-Xmx1024m

3)Restart eclipse

See here 看这里

eclipse.ini look like this. eclipse.ini看起来像这样。

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140116-2212
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
-Xmx1024m

Let me assume this problem caused due to the Android XML, because of very frequently you're opening it 让我假设这个问题是由Android XML引起的,因为你经常打开它

These following two issues on StackOverFlow are realted with each other: 以下关于StackOverFlow的两个问题相互出现:

Every time I click on an Android XML file in Eclipse, it loads data for all API versions 每次我点击Eclipse中的Android XML文件时,它都会加载所有API版本的数据

and

Unable to execute dex: GC overhead limit exceeded 无法执行dex:超出GC开销限制

I found one more solution to resolve this problem other than increasing the VM values or downgrading to an older ADT version (22.6.2 or 23.2) 除了增加VM值或降级到较旧的ADT版本(22.6.2或23.2)之外,我找到了另一个解决此问题的解决方案

Note: 注意:

Some of the older ADT versions which won't load the XML each and every time you open so there is no memory overflow to cause this GC overhead limit exceeded as discussed on the first thread 一些较旧的ADT版本,每次打开时都不会加载XML,因此没有内存溢出导致此GC开销限制超出第一个线程中所讨论的

Solution: 解:

At the bottom of the eclipse there will be Trash can symbol which states Run Garbage Collector . 在日食的底部会有垃圾桶符号,其中包含运行垃圾收集器 Whenever you close an XML file of android don't forget to just click on the Trash Can or Run Garbage Collector to release memory. 每当你关闭android的XML文件时,不要忘记只需单击垃圾桶运行垃圾收集器来释放内存。 This way you can protect the workspace from crashing this kind of error :D 这样,您可以保护工作区不会崩溃这种错误:D

This could be an ultimate solution because you can't increase the VM value beyond your RAM limit if you very frequently open your android XML especially if you do lot of UI works like me :P 这可能是一个终极解决方案,因为如果您经常打开Android XML,就不能将VM值增加到RAM限制之外,特别是如果你做了很多像我这样的UI工作:P

I hope this would help everyone who will come to this thread :) 我希望这会帮助每个人来这个主题:)

Keep Calm and Code On 保持冷静和代码

After 12 hours with this error and no success with changing the eclipse.ini file I finally found the correct solution. 使用此错误12小时后,更改eclipse.ini文件没有成功,我终于找到了正确的解决方案。 In my environment variables there was a variable named "_JAVA_OPTIONS" containing the value "-Xmx512M". 在我的环境变量中有一个名为“_JAVA_OPTIONS”的变量,其中包含值“-Xmx512M”。 Changing this value to the same value as in eclipse.ini (-Xmx4096M) I was once again able to export my project to an APK file. 将此值更改为与eclipse.ini(-Xmx4096M)中相同的值我再次能够将项目导出到APK文件。

I DO NOT know the reason behind this work-around, but it works for me all the time when all of the above don't. 我不知道这种解决方法背后的原因,但是当上述所有情况都没有时,它一直适用于我。

Do not start eclipse from a short-cut or a link. 不要从捷径或链接开始日食。 Always open it from the eclipse.exe in your eclipse folder, the very folder which holds the eclipse.ini 始终从eclipse文件夹中的eclipse.exe打开它,该文件夹包含eclipse.ini

Note - I tried only for linux. 注意 - 我只尝试过linux。

To avoid this annoyable message, i had to change my configuration as follows: 为了避免这个烦人的消息,我不得不改变我的配置如下:

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-

144807
-product
com.android.ide.eclipse.adt.package.adtproduct
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XX:MaxPermSize=256m
-Xms512m
-Xmx1024m

based on the answer marked as correct, changing 根据答案标记为正确,改变

-XX:MaxPermSize=256m
-Xms512m
-Xmx1024m

and: 和:

--launcher.XXMaxPermSize
1024m
1) Open eclipse.ini file
2)change
-Xms40m
-Xmx512m
to 
-Xms512m
-Xmx1024m
3)Restart eclipse

The same eclipse.ini file will be located in Eclipse in this root path of eclipse itself like: 相同的eclipse.ini文件将位于Eclipse的eclipse自身的根路径中,如:

C:\Users\username\Downloads\adt-bundle-windows-x86_64-20140702\eclipse\eclipse.ini

The same file will be located in android studio project:- 同一个文件将位于android studio项目中: -

C:\Users\username\AppData\Local\Android\sdk\tools\lib\monitor-x86_64\monitor(Type:Configuration settings)

If these answers don't work (They didn't for me) then try this: 如果这些答案不起作用(他们不适合我)那么试试这个:

1) Make a copy of your .metadata folder in your workspace. 1)在工作区中制作.metadata文件夹的副本。

2) Delete your .metadata directory AFTER MAKING A COPY 2)复制后删除.metadata目录

3) Open Eclipse and close Eclipse. 3)打开Eclipse并关闭Eclipse。

4) Copy your plugins folder from your old .metadata to your new .metadata 4)将旧的.metadata中的plugins文件夹复制到新的.metadata

5) Import all the projects back into your workspace 5)将所有项目导回到工作区

6) Keep Calm and Code On! 6)保持冷静和代码!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM