IDEA報錯Could not reserve enough space for xxxxKB object heap處理


IDEA開發android工程的時候,啟動就報錯。

Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\musarona\.gradle\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv\gradle-2.14.1'.

Error:Failed to complete Gradle execution.

Cause:
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/2.14.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 1572864KB object heap

這個錯誤的大意就是說IDEA無法給虛擬機分配內存空間。解決這類問題大體是調整idea.exe.vmoptions里面的內存配置。

-XX:ReservedCodeCacheSize=240m

變更為

-XX:ReservedCodeCacheSize=480m

如果還有問題,可以調整idea.exe.vmoptions里的其他選項

-Xmx512m

-XX:MaxHeapSize=512m 

好吧。編輯下,第二天跑工程又不行了,就報這個錯。

編譯器里調整heap調到2G都不行。

百思不得其解。想想這是gradle里報的錯,gradle應該有需要占用內存的配置。打開一看,大吃一驚,gradle默認的jvm內存居然就是1536m,對上了報錯信息里的1572864KB。那就把它改小點吧,改成512m,重啟編譯一次通過。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM