[I am getting error while building the android apk in ionic. It says "Could not reserve enough space for 2097152KB object heap. I tried various option but didnt work out. Please Help"][1]
<img src="https://i.stack.imgur.com/O7Oka.jpg">
[I am getting error while building the android apk in ionic. It says "Could not reserve enough space for 2097152KB object heap. I tried various option but didnt work out. Please Help"][1]
<img src="https://i.stack.imgur.com/O7Oka.jpg">
I was facing the same problem. For me the solution provided by Roman Ashikhmin worked but I found that you also need following Environment Variable too,
GRADLE_OPTS
: -Xmx2048M
along with the
_JAVA_OPTIONS
: -Xmx1024M
Note: For _JAVA_OPTIONS
I tried going over 1024M to 2048M or even 4096M but those options don't work. You can do 512M & or 1024M. For GRADLE_OPTS
gogin over 2048M didn't work either.
I'm on:
Java 32bit jdk-8u141
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 1.3.12
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 2.3.0
System:
Node : v6.11.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10
Try to add a Windows Environment Variable named _JAVA_OPTIONS
with value -Xmx512M
.
It helped me to resolve the same issue.