****[ 35% 11837/33004] build out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack
FAILED:/bin/bash -c
\"
(mkdir -p out/target/common/obj/
Seems like a bug in Android makefiles - 3500 megabytes is really not enough to build some Java packages inside Android. It's hardcoded value, you can find it in build/core/config.mk. For now you can simply increase it locally (however it's weird that it isn't placed in some environment variable).
I've increased it to 5500 megabytes and it works like a charm.