Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

I am getting Unable to execute dex: Java heap space Java heap space error while executing web driver script in Eclipse IDE. I have configured Eclipse IDE with Android SDK and AVD Manager.

I also increased the -Xms200m to -Xmx512m  but it did not work.

1 Answer

0 votes
by (62.9k points)

Added some external JAR to my android project classpath and cleaning and rebuilding the project was giving following error:

Unable to execute dex: Java heap space

Tried increasing heap size in the eclipse.ini file, but was no help. Finally, I found a way to do it. You need to create a User Library and JARs to it. Here it is how to do it in eclipse:

1. Go to Windows > Preference

2. Expand Java > Build Path > User Libraries

3. Click "New" and give some name in "User Library Name" field and click OK.

4. Now select Library Name and click on the "Add JARs" button.

5. Select JARs required to be used in the Android project and click OK and OK again.

Bingo user library is created. Now add this user library to build path of your project:

1. Right-click on the project name and select "Properties" from the context menu.

2. Click on Java Build Path

3. Click "Add Library" and select "User Library" and click next.

4. Select the checkbox in front of the user library you want and click finish.

5. Click OK.

This has resolved the Heap Size problem. Also if you need to increase heap size in the eclipse.ini file. -XX:MaxPermSize=128m

Browse Categories