Failed to sync Gradle project

喜夏-厌秋 提交于 2020-01-10 07:18:21

问题


I am using Android studio 1.3.1 and getting this failed to sync Gradle project error :

Error:Unable to start the daemon process: could not reserve enough space for
object heap.            
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file,
sets the  maximum Java heap size to 1,024 MB:
org.gradle.jvmargs=-Xmx1024m

my default org.gradle.jvmargs=-Xmx2048 and MaxPermSize=512m still it is showing me this error, can anybody tell me why I am getting this error?


回答1:


Method 1 :

For Android Studio 1.3 :

Step 1 : Open gradle.properties file in your Android Studio project.

Step 2 : Add this line at the end of the file

org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m

Above methods seems to work but if in case it won't then do this

Method 2 :

Step 1 : Start Android studio and close any open project (File > Close Project).

Step 2 : On Welcome window, Go to Configure > Settings.

Step 3 : Go to Build, Execution, Deployment > Compiler

Step 4 : Change Build process heap size (Mbytes) to 1024 and Additional build process to VM Options to -Xmx512m.

Step 5 : Close or Restart Android Studio.




回答2:


try this way Open gradle.properties file.

add this line at the end:

org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m

or

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



回答3:


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

Add this Line to the End of the gradle.properties file in Your project.

remember without '#'..



来源:https://stackoverflow.com/questions/32022765/failed-to-sync-gradle-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!