Question

I am so tired of this java heap space error on my eclipse whenever I build my android application. I add 9 libraries to my android application. (Right click on project name -> Properties -> Android -> Add library).

In some forums, I find people asking to make changes in eclipse.ini file and some saying to add user library and add jars to it. And add user library to my app.

I have changed my MaxPermSize to 1024 in eclipse.ini. It didnt help

When I add user library to my app, my app is not able to recognise app_compat_v7.jar. It throws error on styles file where I use Theme.Appcompat.Light

May I know where I am going wrong ? Any help will be appreciated.

Was it helpful?

Solution

Try the following:

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

And

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

On doing this Eclipse will take only the classes which are needed in the code, from the jar instead of storing all the classes from the jar.

And also see this question.

Second Technique

Modify the -XmsAm and -XmxBm paremeters in eclipse.ini so that they are large enough. The default is -Xms40m -Xmx384m. Try changing them both to -Xms512m -Xmx512m and restart eclipse to see if that helps. If not, continue to increase the values and restart eclipse until either one of two things happens:

  1. Your build completes.
  2. Eclipse won't restart because you don't have enough memory.

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

For MAC please see:

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top