Search code examples
androideclipsejaremulationhtmlunit

Android project becomes terribly slow after adding HtmlUnit JARs to eclipse buildpath


I am trying to develop an android application which includes login functionality. To achieve this I used the HtmlUnit package and added the relevant JARs to the eclipse buildpath. After that my eclipse becomes quite slow and unresponsive. When I try to build the project and run it, it got stuck during the building process and reports the following:

Problem occurred: Unable to execute dex: Java heap space

And then: An out of memory error has occurred.

So I guess it might got stuck in some infinite loops when building. Has anyone met similar problems like mine? Or is it a common problem that Android projects can get very troublesome after importing some java libraries that are not known to be fully compatible with Android? Thanks!


Solution

  • This is due to an out of memory error encountered by Eclipse because of the large amount of .jars. This can easily be fixed by increasing the heap space allocated to Eclipse as seen here. For windows, just go to the program -> properties, and in the "target" box, add an extra param like -Xmx1024m.

    Cheers.