1. 程式人生 > 程式設計 >Android Studio error: Unable to start the daemon process的解決方法

Android Studio error: Unable to start the daemon process的解決方法

在 Android Studio 上新建專案,出現 Unable to start the daemon process. 錯誤,具體錯誤資訊如下:

Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example,an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html

Please read the following process output to find out more:
-----------------------

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

解決方法一、

方法一:刪除 C:\Users\UserName\.gradle 目錄,重新啟動 Android Studio即可。重啟動後,它會自動為你建立一個新的。

方法二:修改配置。File -> Settings. 選擇左邊導航欄的Compiler項,設定 VM Options 為 -Xmx512m即可。

方法三:其它應該,留出更多的記憶體空間試試。

解決方法二、

在stackoverflow上找到解決方法:
Android Studio預設為Gradle daemon process分配的heap size過大(windows平臺下預設最大heap size為:75% of total physical memory up to 1 GB),所以容易造成空間不足無法啟動的問題。把空間配置稍小一點即可。
在Android Studio中進入

File->Settings->Compiler

將VM Options配置為一個較小的值,如-Xmx512m。

重啟Android Studio問題解決。

解決方法三、

1、可能是由於防毒軟體等解除安裝或者禁止了daemon程序,因此,重啟電腦可以解決該問題.
2、進入Chapter 6. The Gradle Daemon進行配置,其主要講述C:\Users\Administrator\.gradle路徑下(其中Administrator是自己的使用者名稱),新建gradle.properties檔案,並寫入org.gradle.daemon=true

一般新增 org.gradle.jvmargs=-Xmx512m 好了