Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap
ionic build android后的报错问题
ionic 升级了splashscreen和statusbar的插件后,执行ionic build android会一直报打包错误。原因是过低的android-platform版本不支持新的 splashscreen和statusbar插件
解决 办法是: ionic platform add android@6.1.2 添加android平台前加上版本号就行
然而,又有了新的问题:error occurred during initialization of vm could not reserve enough space for 2097152kb object heap
1、这时候报虚拟内存不足-----------因为我的电脑是32位的win7 ,经测试,64位的没有这个错误。一般报这个内存不足,java的做法就是去eclipse的option修改jre的参数值就行了。
2、但ionic的做法有点不一样:在 ionic platform add android@6.1.2 后,在 platforms\android\cordova\lib\builders 的文件夹下会有一个文件 gradlebuilder.js 。
3、用记事本打开这个文件,在内容中找到 args.push('-dorg.gradle.jvmargs=-xmx2048m');把这个2048m调小,具体看你的机器,我调的为256m;
4、如果没有找到 args.push('-dorg.gradle.jvmargs=-xmx258m'); 那么在 gradlebuilder.prototype.getargs 的函数里面的return前加上这句代码就行。
5、最后执行ionic build android就可以跟之前一样的打包了
上一篇: 一道面试题(C语言)
下一篇: React之小知识点总结
推荐阅读
-
Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap
-
启动tomcat,报错 Error occurred during initialization of VM Could not reserve enough space for object
-
Error occurred during initialization of VM Could not reserve enough space for ob
-
Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap