Here's a build issue that I am struggling with. I am trying to build Android 2.1 on Mac OS X 10.6.8 with jdk 1.5. The "make" command runs for a while and at the end, it says:
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
at com.sun.tools.javac.code.Scope.dble(Scope.java:150)
at com.sun.tools.javac.code.Scope.enter(Scope.java:185)
at com.sun.tools.javac.comp.MemberEnter.importAll(MemberEnter.java:129)
at com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:504)
at com.sun.tools.javac.tree.Tree$TopLevel.accept(Tree.java:382)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:383)
at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:778)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:355)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:612)
at com.sun.tools.javac.comp.Enter.complete(Enter.java:463)
at com.sun.tools.javac.comp.Enter.main(Enter.java:441)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:404)
at com.sun.tools.javac.main.Main.compile(Main.java:592)
at com.sun.tools.javac.main.Main.compile(Main.java:544)
at com.sun.tools.javac.Main.compile(Main.java:92)
at util.build.JavacBuildStep.build(JavacBuildStep.java:69)
at util.build.BuildDalvikSuite.handleTests(BuildDalvikSuite.java:504)
at util.build.BuildDalvikSuite.compose(BuildDalvikSuite.java:170)
at util.build.BuildDalvikSuite.main(BuildDalvikSuite.java:136)
main javac dalvik-cts-buildutil build step failed
make: *** [out/host/darwin-x86/obj/EXECUTABLES/vm-tests_intermediates/tests] Error 1
It seems that the java heap size is insufficient. I searched for this problem on Google which gave me several links such as:
- How to deal with "java.lang.OutOfMemoryError: Java heap space" error (64MB heap size)
- Change Java heap size on a Mac
These pages mainly suggest to add the "-Xmx" option to the JVM Options. I tried the following: Added this column in /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard/Resources/Info.plist"
VMOptions -Xms1024M -Xmx2048M
(I also tried setting VMOptions.x86_64 instead of VMOptions).
Following another link (osdir.com/ml/android-platform/2010-06/msg00097.html), I also changed the following line in build/core/definitions.mk file inside the android build directory.
$(hide) java -Xmx512M -jar $(HOST_OUT_JAVA_LIBRARIES)/proguard-4.0.1.jar \
to
$(hide) java -Xmx2048M -jar $(HOST_OUT_JAVA_LIBRARIES)/proguard-4.0.1.jar \
None of the above has helped. I have few questions:
- Is it possible to change system wide java heap size on Mac OS X and is that the right way to go? If so, whether the change I did in Info.plist file would achieve that?
- Or is it that I have to change the heap size specifically for the android build? If so, how should I do it?
Edit
Just an update: I tried building android 3.1 with jdk 1.6 and the build went fine. (even without setting the "-Xmx" option for jdk 1.6). I still don't know what's the problem while building 2.1 with jdk 1.5.