Mohamed Yehia
Mohamed Yehia

Reputation: 401

GC overhead limit exceeded - Android Studio

Android studio 2.2 was working good for me and build fast but now after updating to 2.3 ! it takes a lot of time to build my projects and also After a period of time Android studio failed because of this exception

Error:A problem occurred configuring project ':app'. Failed to notify project evaluation listener. GC overhead limit exceeded

any help !

Upvotes: 4

Views: 2821

Answers (2)

Victor Oliveira
Victor Oliveira

Reputation: 3713

I had several problems with tests stuck while migrating to Gradle 5. Some reports went from

GC overhead limit exceeded

to tests even being deadlocked. What solved my problem, apart from increasing 1g heap to 8g with

org.gradle.jvmargs=-Xmx8g -XX\
  \:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -Dfile\
  .encoding=UTF-8

was to disable binary resources for Robolectric

android.enableUnitTestBinaryResources=false

since my project would not support it. Those lines should be settle under gradle.properties file.

I also suggest to invalidate caches & restart Android Studio, clean project, etc, after setting those configs and before running your gradle tasks again.

Upvotes: 0

Autumn's Fall
Autumn's Fall

Reputation: 225

Try adding this to your gradle.properties:

        org.gradle.daemon=true
        org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
        org.gradle.parallel=true
        org.gradle.configureondemand=true

Upvotes: 11

Related Questions