本文轉載自:https://blog.csdn.net/dhx20022889/article/details/44919905
我在用android studio 做一個小專案,在家裡的mac電腦中建立專案,並同步到coding.net中。
到公司電腦中下拉此專案,並通過android studio開啟,可開啟後的專案報如下錯誤:
- 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 http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html
- Please read the following process output to find out more:
- -----------------------
- Error occurred during initialization of VM
- Could not reserve enough space for object heap
- Error: Could not create the Java Virtual Machine.
- Error: A fatal exception has occurred. Program will exit.
當然,試圖編譯或執行,都是不成功的。
經google發現,原來android studio是通過gradle對專案配置的,而系統中沒有對android studio 的預設配置,就像Eclipse中的eclipse.ini檔案。
解決方法:
在作業系統當前使用者的.gradle資料夾下:C:\Users\Administrator\.gradle 設定gradle.properties,若無就新增。
在檔案中新增如下配置資訊:
- org.gradle.jvmargs=-Xmx512m
重啟專案,問題解決。