VM初始化期间发生Android Studio1.5错误无法为对象堆保留足够的空间

时间:2016-01-20 10:23:17

标签: java android

当我运行我的项目时,出现错误。

Starting process 'command 'C:\Java\jdk1.7.0\bin\java.exe''. Working     directory: C:\Users\john\AndroidStudioProjects\Prefs\app Command: C:\Java\jdk1.7.0\bin\java.exe -Djava.awt.headless=true -Xmx1024M -Dfile.encoding=UTF-8 -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\Users\john\AppData\Local\Android\sdk1\build-tools\21.1.2\lib\dx.jar com.android.dx.command.Main --dex --verbose --output C:\Users\john\AndroidStudioProjects\Prefs\app\build\intermediates\pre-dexed\debug\com.android.support-support-v4-21.0.3_42a7fe41e85c69c43b7a4dd1dda945656e9dd165.jar C:\Users\john\AndroidStudioProjects\Prefs\app\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.3\jars\classes.jar 
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.:app:transformClassesWithDexForDebug FAILED:app:transformClassesWithDexForDebug (Thread[Daemon worker Thread 8,5,main])completed. Took 0.549 secs.

我设置.gradel.properties并且gradle可以重建和清理

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=128m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

在C:\ User \ john \ .gradle \ daemon \ 2.8 \ gradle.properties中设置

org.gradle.jvmargs=-Xms256m -Xmx512m

环境

os:windows7 RAM:4G JVM:1.7 android studio 1.5

为什么运行'java.exe -Xmx1024m'命令。当我将此命令更改为“-Xmx512m”并在命令行中运行时,此命令已成功执行。

如何减少此命令中的jvm。我在很多时候搜索这个问题买不解决问题。 请帮助我,非常感谢。

0 个答案:

没有答案