Android eclipse cannot execute dex java heap space error

Android eclipse cannot execute dex java heap space error … here is a solution to the problem.

Android eclipse cannot execute dex java heap space error

Whenever I build my android app, I’m tired of this java heap space error on my eclipse.
I added 9 libraries to my android app. (Right-click the project name -> Properties -> Android -> Add Library).

On some forums, I found that there were requests to change the eclipse.ini file, and some people said to add user libraries and add jars to them. and add the user library to My App.

I’ve changed my MaxPermSize to 1024 in eclipse.ini. It didn’t work

When I add the user library to my app, my app doesn’t recognize the app_compat_v7.jar. It throws an error in my style file using Theme.Appcompat.Light

Can I know where I went wrong? Any help would be appreciated.


Try the following:

Right click your project. Go to Properties -> Java Build Path -> Order and Export.


Uncheck the check box against your included library. Press OK and run the project.

When you do this, Eclipse gets only the classes needed in your code from the jar, instead of storing all the classes in the jar.

See also this question .

Second technique

Modify the -XmsAm and -XmxBm parameters in eclipse.ini to make them large enough. The default value is -Xms40m -Xmx384m. Try changing them both to -Xms512m -Xmx512m and restarting Eclipse to see if that helps. If not, continue to increment the value and restart Eclipse until one of two things occurs

  1. Your build is complete.
  2. Eclipse does not restart because you do not have enough memory.

eclipse.ini is located in the /etc/eclipse .ini in Ubuntu (assuming you installed Eclipse from an Ubuntu repository).

MAC please see:

Finding Eclipse.ini is a bit tricky. To locate it, right-click the Eclipse application icon and select Show Package Contents, then double-click the Content folder, and then double-click the MacOS folder, the home directory of eclipse.ini

Related Problems and Solutions