Android Dev: Eclipse IDE “GC overhead limit exceeded”

We often consult on Android projects that need bugs and issue fixed, or more advanced features developed. When doing this, we often pull from some repo’s (SVN Repositories), and when adding these to your IDE workspace, (Eclipse IDE, in our case) an issue sometimes occurs when checking in a large or heavy sized Android project. One Android Dev: Eclipse IDE setting issue I often see is:

1
Unable to execute dex: GC overhead limit exceeded
Android Dev: Eclipse error: GC overhead limit exceeded

Android Dev: Eclipse error: GC overhead limit exceeded

Have you gotten these errors?

1
2
[2013-04-03 00:00:00 - Dex Loader] Unable to execute dex: GC overhead limit exceeded
[2013-04-03 00:00:00 - OsmAnd] Conversion to Dalvik format failed: Unable to execute dex: GC overhead limit exceeded

The error is caused by Eclipse not having enough memory for large projects. So to fix it this is what is needed.

Change some values in your Eclipse.ini file. This file is located wherever you downloaded Eclipse. If you don’t know where that is, then check your Downloads folder. Depending on which version of Eclipse you are using, the folder may either be called something like “eclipse-mobile-juno-SR1-win32-x86_64″ or “adt-bundle-windows-x86_64-20130219″, if you didn’t already move the eclipse folder from within it.

When you open Eclipse.ini, you should see something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-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.v20120522-1813
-product
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
256M
-showsplash
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms512m
-Xmx1024m
-Declipse.buildId=v21.1.0-569685

Change the two values at the bottom to something like the following and you’ll be better off. Just restart Eclipse for the changes to take effect.

1
2
-Xms512m
-Xmx1024m

This should fix your “GC overhead limit exceeded” issue after the restart. Android Dev: Eclipse IDE.