Android Studio Error -- Could not create the Java Virtual Machine
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Android Studio Error -- Could not create the Java Virtual Machine,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1637字,纯文字阅读大概需要3分钟。
内容图文
:app:dexDebug Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:app:dexDebug‘. > com.android.ide.common.internal.LoggedErrorException: Failed to run command: E:\Program Files\adt-bundle-windows-x86-20140702\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output E:\android\workspace\DialogDemo\app\build\intermediates\dex\debug --input-list=E:\android\workspace\DialogDemo\app\build\intermediates\tmp\dex\debug\inputList.txt Error Code: 1 Output: Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED
Gradle打包的时候经常出现此错误,命令--stacktrace
Error occurred during initialization of VM
Could
not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
目前google and 百度查询有两种解决方案
1.设置java的
-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
修改这三个参数
2.升级JDK
经过测试2种方案都不行
通过
dx.bat --dex
命令的dx.bat脚本有这样一句代码
REM
By default, give dx a max heap size of 1 gig and a stack size of 1meg.
rem
This can be overridden by using "-JXmx..." and "-JXss..." options below.
set defaultXmx=-Xmx1024M
set defaultXss=-Xss1m
set defaultXmx=-Xmx1024M
原因就是此处设置的Xmx为1024M,编译打包APK时java虚拟机内存空间不足,修改为512M即可正常编译打包了。
set defaultXmx=-Xmx1024M
原文:http://www.cnblogs.com/fenglie/p/4208678.html
内容总结
以上是互联网集市为您收集整理的Android Studio Error -- Could not create the Java Virtual Machine全部内容,希望文章能够帮你解决Android Studio Error -- Could not create the Java Virtual Machine所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。