kapt An exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded
Following gradle settings worked for me.
-Xms256m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
This goes in your settings.gradle file as the value for the org.gradle.jvargs parameter, e.g.
org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
put line
org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
to your gradle.properties (Project Properties)