Unable to execute dex: GC overhead limit exceeded in Eclipse

纵饮孤独 提交于 2019-12-17 03:46:01

问题


When I downloaded the Git project OsmAnd and went to compile it, Eclipse returned these errors:

[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. Conversion to Dalvik format failed: Unable to execute dex: Java heap space.
I cleaned project and restarted Eclipse, but it did not help.

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.


回答1:


It can be fixed by changing the VM values in Eclipse.ini. Set the values to 512 and 1024 as below:

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

The changed area in image




回答2:


For me following steps worked

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

3)Restart eclipse

See here




回答3:


eclipse.ini look like this.

-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



回答4:


Let me assume this problem caused due to the Android XML, because of very frequently you're opening it

These following two issues on StackOverFlow are realted with each other:

Every time I click on an Android XML file in Eclipse, it loads data for all API versions

and

Unable to execute dex: GC overhead limit exceeded

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)

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

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. This way you can protect the workspace from crashing this kind of error :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

I hope this would help everyone who will come to this thread :)

Keep Calm and Code On




回答5:


After 12 hours with this error and no success with changing the eclipse.ini file I finally found the correct solution. In my environment variables there was a variable named "_JAVA_OPTIONS" containing the value "-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.




回答6:


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

Note - I tried only for linux.




回答7:


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



回答8:


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:

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

The same file will be located in android studio project:-

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



回答9:


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.

2) Delete your .metadata directory AFTER MAKING A COPY

3) Open Eclipse and close Eclipse.

4) Copy your plugins folder from your old .metadata to your new .metadata

5) Import all the projects back into your workspace

6) Keep Calm and Code On!



来源:https://stackoverflow.com/questions/9471194/unable-to-execute-dex-gc-overhead-limit-exceeded-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!