Sometimes your Android builds need more than 4G of RAM and get OOM error. When you see the issue, you can try adding the following to your circle.yml.
machine:
environment:
GRADLE_OPTS: -Xmx1024m -XX:MaxPermSize=1024m
java:
version:
oraclejdk8