# Invalid maximum heap size: -XX:MaxHeapSize=4096m

**URL:** <https://forums.unrealengine.com/t/invalid-maximum-heap-size-xx-maxheapsize-4096m/473893>\
**Category:** Getting Started & Setup\
**Tags:** error-building, unreal-engine, java, question\
**Created:** [November 2, 2020, 7:31pm UTC](https://forums.unrealengine.com/t/invalid-maximum-heap-size-xx-maxheapsize-4096m/473893 "2020-11-02T19:31:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f63792e0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f63792e0](https://forums.unrealengine.com/u/anonymous_user_f63792e0)\
**Post date:** [November 2, 2020, 7:31pm UTC](https://forums.unrealengine.com/t/invalid-maximum-heap-size-xx-maxheapsize-4096m/473893/1 "2020-11-02T19:31:05Z")

</div>

Hello,  
I just installed UE4 and was trying to launch a demo on my Android phone. I set the location of the SDK, launched the AndroidSetup.bat to download the NDK and then specified the path. But now when i’m compiling the project I have an error caused by JAVA that I’m not able to solve. So I need your help ! Do you have an idea of what may cause that ? I updated JAVA but still the same error.

![]()

![]()

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f63792e0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f63792e0](https://forums.unrealengine.com/u/anonymous_user_f63792e0)\
**Post date:** [November 2, 2020, 8:07pm UTC](https://forums.unrealengine.com/t/invalid-maximum-heap-size-xx-maxheapsize-4096m/473893/2 "2020-11-02T20:07:23Z")

</div>

I just needed to migrate to Java 64bit. My Java 32bit was limited to 2GB heap size.

---

<div class="post-metadata">

**Author:** ![Dynamit\_Balte](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dynamit\_Balte](https://forums.unrealengine.com/u/Dynamit_Balte)\
**Post date:** [March 5, 2023, 2:23pm UTC](https://forums.unrealengine.com/t/invalid-maximum-heap-size-xx-maxheapsize-4096m/473893/3 "2023-03-05T14:23:41Z")

</div>

anyone hava a fix for this?
