I'm working with Android-x86, but the problem I have is with make command, not Android.
I'm trying to compile Android-x86 Oreo as android_x86_64-userdebug using m -j2 iso_img, and I'm stuck in a loop. While compiling using java, it gave a common error, "Out of memory error". Well, I know I can use java -Xmx512m -Xms512m [jar, class, whatever], but since I’m using make command, I can't pass these arguments directly. What I did was to run export _JAVA_OPTIONS="-Xmx512m -Xms512m" so it was going to include these options as well. It didn't. It changed absolutely NOTHING. I tried several times, but nothing changes.
So, my question is:How can I pass a maximum heap size for java while using make command?I’m sorry if it’s the wrong site to ask this.
1 Answer
Well, I managed to fix it myself. For those who are having the same problem, here is my fix:
Let’s say your normal command is:
make -j2 OUT_DIR=/path/to/some/dirAt the end of the command, add a space than add JAVA_OPTS=-Xmx1024m, for example:
make -j2 OUT_DIR=/path/to/some/dir JAVA_OPTS=-Xmx1024mYou have to change 1024 to your desired maximum heap size in Megabytes. Hope this helps!