cordova build android Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap

因为之前装好过系统出了点问题 修复了一下 把我安卓和java的环境给清空了

这次cordova打包才发现,通过cordova requirements发现配置问题,并都一一解决了,结果一直报错

Error occurred during initialization of VM  Could not reserve enough space for 2097152KB object heap

说是内存不足,网上查了半天才找到问题

大体的意思是系统内存不够用,创建VM失败。试了网上好几种方法都不行,最后这个方法可以了:

开始->控制面板->系统->高级设置->环境变量->系统变量

新建变量:

变量名: _JAVA_OPTIONS 

变量值: -Xmx512M

PS:如果其他工具也遇到这个2097152KB 数字,就按照这个设置一下也OK!

参考文档:https://www.cnblogs.com/slmk/p/6260224.html

你可能感兴趣的:(cordova build android Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap)