java.lang.OutOfMemoryError: GC overhead limit exceeded

After upgrading Google Play services library from 9.4.0 to 10.2.0 Gradle build fails with following error:

Information: Gradle tasks [:app:assembleDebug]
Error: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error: Execution failed for task ':app:transformClassesWithDexForDebug'.
> java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Information:BUILD FAILED

The issue was resolved by adding following code to build.gradle within  android {...}:

dexOptions {
    javaMaxHeapSize "2g"

Android Studio 2.2.3

No thoughts on “java.lang.OutOfMemoryError: GC overhead limit exceeded”

Leave your comment

In reply to Some User


Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait