GC overhead limit exceeded when enable R8 Shrinker in Android Studio GC overhead limit exceeded when enable R8 Shrinker in Android Studio android android

GC overhead limit exceeded when enable R8 Shrinker in Android Studio


As you said you are not using any custom JVM args, try it out.

In your gradle.properties file try several values for memory settings. For example try to set

org.gradle.jvmargs=-Xmx4096m

As suggested by the commented section:

Specifies the JVM arguments used for the daemon process.

The setting is particularly useful for tweaking memory settings.

org.gradle.jvmargs=-Xmx1536m

I've used R8 in my project and all worked fine.


Sometimes adding JVM heap memory does not solve the problem especially on systems that have limited memory, it will cause other problems. my recommendation is to try replacing the Garbage Collector.

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC

GC overhead limit exceeded is an exception throw by default java 8 garbage collector (Parallel). In my case, it solved the problems.