views:

108

answers:

2

I'm working on a project with a group that is using Eclipse, but I'm using Netbeans. Up until today this wasn't an issue. When updating from the repo they have added some source code as a library under a directory called /lib-src. When I try to compile the code I get an error that it can't find certain packages... these are the packages under /lib-src.

Using NetBeans I can add the library as a folder so now the references to those packages are happy. However, I'm getting this new error when compiling:

UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
    at java.util.HashMap.addEntry(HashMap.java:753)
    at java.util.HashMap.put(HashMap.java:385)
    at com.android.dx.dex.file.ClassDataItem.addStaticField(ClassDataItem.java:134)
    at com.android.dx.dex.file.ClassDefItem.addStaticField(ClassDefItem.java:280)
    at com.android.dx.dex.cf.CfTranslator.processFields(CfTranslator.java:159)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:130)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85)
    at com.android.dx.command.dexer.Main.processClass(Main.java:297)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:276)
    at com.android.dx.command.dexer.Main.access$100(Main.java:56)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:228)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:134)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
    at com.android.dx.command.dexer.Main.processOne(Main.java:245)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
    at com.android.dx.command.dexer.Main.run(Main.java:139)
    at com.android.dx.command.dexer.Main.main(Main.java:120)
    at com.android.dx.command.Main.main(Main.java:87)
/home/aaron/NetBeansProjects/xbmc-remote/nbproject/build-impl.xml:411: exec returned: 3
BUILD FAILED (total time: 1 minute 25 seconds)

I can include the build-impl.xml file if you need it, but I don't think that is main issue.

Any ideas?

+1  A: 

You could try making the heap space bigger by adding "-Xmx512m" as a JRE command line argument. This can be done permanently by editing netbeans.conf (or via the JRE options through the IDE).

netbeans.conf is is located in the etc directory of your netbeans installation directory. The JRE options used by NetBeans can be accessed by right clicking your project in NetBeans, selecting Properties -> Run -> VM Options.

JRL
Where is that file located? I can't find JRE Options anywhere under Tools -> Options. Where do I go to set that in the IDE?
DJTripleThreat
@DJTripleThreat: see edits in my post.
JRL
+1  A: 

Is the dx.bat somehow involved, as in this thread?

It seems that Android built tools do not use ANT_OPTS variable while running dex tool.
Problem can be solved by uncommenting line in dx.bat batch file.

You can find it in android SDK folder under platforms/YOUR_PLATFORM/tools/dx.bat.
At the very end of file there is commented command to increase heap space.
Uncommenting this line should solve the problem. Line should looks like this:

set javaOpts=-Xmx256M
VonC
That did it, thanks.
DJTripleThreat