Android java.lang.OutOfMemoryError: GC overhead limit exceeded
本文最后更新于 2017年2月13日 晚上
再用 Android Studio 编辑项目的时候,会出现如下错误。
1 | |
根据 Sun 的描述:
1
"if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown."
首先更改 Android Studio 的运行内存,MacBook 在Content/bin/studio.vmoptions,修改如下
1 | |
之后在项目的build.gradle中添加一个设置:
1 | |
接下来运行就能通过。
Android java.lang.OutOfMemoryError: GC overhead limit exceeded
https://yuluod.github.io/2017/02/13/Android-java-lang-OutOfMemoryError-GC-overhead-limit-exceeded/