Java.lang.OutOfMemoryError while running android 2.1 on Mac OS X 10.6.8

Here is the build problem I'm struggling with. I am trying to create Android 2.1 on Mac OS X 10.6.8 using jdk 1.5. The make command has been running 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 not enough. I searched for this problem on Google, which gave me some links, for example:

These pages basically suggest adding the "-Xmx" option to the JVM options. I tried the following: Added this column to /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 the 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 helped. I have few questions:

  • Is it possible to change the java system heap size on Mac OS X and what is the correct way? If so, did this change the Info.plist file?
  • Or should I resize heap specifically for Android build? If so, how do I do this?

Edit

Just an update: I tried building Android 3.1 using jdk 1.6, and the build went fine. (even without setting the "-Xmx" option for jdk 1.6). I still don't know what the problem is when building 2.1 using jdk 1.5.

+4
source share
2 answers

Sometimes OutOfMemoryError not a scarce Heap . Try increasing PermGen :

 -XX:PermSize=40m -XX:MaxPermSize=240m 

Sometimes it is also caused by the fuzzy sizes of both Young and Ternured . And some others, because of the long time they make Full GC and collect a low percentage.

Sincerely.

0
source

I think there is a separate way to increase the heap limit of the dexing operation. Add this to the Android close in the build.gradle file:

 dexOptions { javaMaxHeapSize "4g" } 

and see if that helps.

see this link: https://groups.google.com/forum/#!topic/adt-dev/r4p-sBLl7DQ

0
source

All Articles