1

After clear project and build succed. I run Android project in Android studio, it appeared error bellow, who can give me solutions resolve problem, thanks!:

> com.android.ide.common.internal.LoggedErrorException: Failed to run command:....
Error Code:
    1
Output:
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    Invalid maximum heap size: -Xmx4g
    The specified size exceeds the maximum representable size.


Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    Invalid maximum heap size: -Xmx4g

My android studio config (studio.exe.vmoptions):

-server
-Xms512m
-Xmx1024m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=150m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Djna.nosys=true
-Djna.boot.library.path=

-Djna.debug_load=true
-Djna.debug_load.jna=true
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Didea.paths.selector=AndroidStudio1.2
-Didea.platform.prefix=AndroidStudio
Seki
  • 11,135
  • 7
  • 46
  • 70
Huỳnh Ngọc Bang
  • 1,572
  • 1
  • 19
  • 22
  • I was getting the same problem and this answer helped me: http://stackoverflow.com/questions/18723755/android-studio-how-to-increase-allocated-heap-size/18900271#18900271 – JoughTheFun Jul 29 '15 at 19:40

1 Answers1

5

This is a configuration option in your projects "build.gradle" file. Look for something like this:

dexOptions {
    javaMaxHeapSize "4g"
}