Error Java Heap size in Android Studio 1.3.1

2019-01-18 16:01发布

问题:

I recently updated Android Studio from 1.2 to 1.3.1. After updating Gradle Sync failed message is started showing up to increase Java heap size.

Following is the screenshot of error.

TIA

回答1:

Go to your Android Studio Folder Where it is installed. There is File stduio.exe and studio64.exe with file type of VMOPTIONS, open it in notepad you will see Something like this:

-Xms512m
-Xmx1280m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=225m
-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.3
-Didea.platform.prefix=AndroidStudio

According to error you may need to change 2 values in it.

-Xms512m
-Xmx1280m

check this value and change it.



回答2:

open your projects gradle.properties file and paste it.

org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m


回答3:

On Windows 7, what worked for me was to point the Android Studio JDK location to where the system JDK (latest) was located.

In the following images, I've marked in red the bits that should be the same.

Android Studio project, File > Project Structure > SDK Location > JDK Location:

Command line, java -version:



回答4:

Just open the gradle.properties file in your projects and add:

org.gradle.jvmargs=-Xmx1024m

I met this problem when I upgraded my system to win10



回答5:

I had the same problem as you had. But now I have solve it just Updating my JDK version 1.7 to 1.8. Now it’s working fine for me. And configure the Environment Variable with JAVA_HOME and Android Studio ->Project Structure->SDK Location=>JDK Location.



回答6:

In Android Studio go to Help-> Edit Custom VM Options. Hit yes button and then change 1st two values.
More Info - https://developer.android.com/studio/intro/studio-config.html