Cordova Could not reserve enough space for 2097152KB object heap
Solution 1:
Try again after increasing your Java VM(?) memory size.
Here is how to fix it on a Windows platform:
Go to Start -> Control Panel -> System -> Advanced(tab) -> Environment Variables -> System Variables -> New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Don't ignore the score and underscore characters.
Solution 2:
I had the exact same problem. I switched to use 64-bit JDK as suggested in here and it worked fine. I was using Ionic 3.5.0 on Windows 10.
Solution 3:
args.push('-Dorg.gradle.jvmargs=-Xmx2048m')
into
args.push('-Dorg.gradle.jvmargs=-Xmx1024m');
on the following location files.
project-folder\platforms\android\cordova\lib\builders\GradleBuilder.js
project-folder\platforms\android\cordova\lib\builders\StudioBuilder.js