****[ 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/
Google recommends minimum 16GB of RAM for building source code and we have experienced that with Android N it is indeed mandatory.
Unless 16 GB of RAM is given to machine, reliability of source code build is really really low. You may try multiple configurations of jack-server and parameters but none of them may prove to be a reliable.
This is running thread of similar problems faced by many :- https://code.google.com/p/android/issues/detail?id=194027
I hope this helps !