java.lang.OutOfMemoryError: GC overhead limit exceeded on Android 1.4

Add this to your android closure(build gradle):

 dexOptions {
        javaMaxHeapSize "4g"
 }

This will solve your problem. Still, if you face problem see the following link

GC overhead limit exceeded error


This is what I suggest:

Add this to your "gradle.properties" file:

org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError

Also, read this article. You might be able to make the building a bit faster, by adding a combination of those:

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true