Error Java Heap size in Android Studio 1.3.1

2019-01-18 15:12发布

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

enter image description here

6条回答
太酷不给撩
2楼-- · 2019-01-18 15:44

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

查看更多
一纸荒年 Trace。
3楼-- · 2019-01-18 15:46

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.

查看更多
Deceive 欺骗
4楼-- · 2019-01-18 15:51

open your projects gradle.properties file and paste it.

org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m
查看更多
smile是对你的礼貌
5楼-- · 2019-01-18 15:58

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

查看更多
走好不送
6楼-- · 2019-01-18 16:01

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: enter image description here

Command line, java -version: enter image description here

查看更多
爷、活的狠高调
7楼-- · 2019-01-18 16:04

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.

查看更多
登录 后发表回答