Unable to execute dex because of java heap space in eclipse with a tiny android application

13,750

Solution 1

I read, that symja library needs Java version 1.6. But your Eclipse uses Java 1.5. Maybe, it's a problem.

Solution 2

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.

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.

Solution 3

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:

Your build completes. 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).

Share:
13,750
Zach
Author by

Zach

Updated on June 04, 2022

Comments

  • Zach
    Zach about 2 years

    I have an android application that only has one jar import which is 4 mb in size (Symja https://code.google.com/p/symja/) Literally the only code in the project is creating a new textview and setting it as the content view. But I am getting the error(s):

    Conversion to Dalvik format failed: Unable to execute dex: Java heap space
    Unable to execute dex: Java heap space
    

    I have another android project which is alot bigger, almost 20,000 lines of code and it runs in seconds. My eclipse.ini has the following settings:

    -Dosgi.requiredJavaVersion=1.5
    -XX:MaxPermSize=512m
    -Xms512m
    -Xmx1024m
    

    I do not know why I cannot run this project. So any suggestions are greatly appreciated!

    Thanks.