Robert J. Clegg
Robert J. Clegg

Reputation: 7360

java.lang.OutOfMemoryError: GC overhead limit exceeded

Using Android Studio 3.0 Beta 6. This error is happening more and more, when I try build my project:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. java.lang.OutOfMemoryError: GC overhead limit exceeded

I have tried to fix it using this SO answer: Android Studio: GC overhead limit exceeded

However it has made no difference. The only way to fix it, is a reboot of my MBP and then all is fine for the next few builds, until it resurfaces again.

Any ideas how to fix this?

Upvotes: 0

Views: 1100

Answers (1)

Kuls
Kuls

Reputation: 2067

I was facing the same issue and it is resolved by adding following codes, Add this to your build.gradle file:

dexOptions { 
          incremental true 
          javaMaxHeapSize "4g" 
} 

Upvotes: 1

Related Questions