[Solved] Android compile error: cannot allocate memory

Problem:
[ 13% 3960/28350] target thumb C++: libRSDriver <= frameworks/rs/driver/rsdScriptGroup.cppninja: fatal: fork: Cannot allocate memory
build/core/ninja.mk:148: recipe for target ‘ninja_wrapper’ failed
make: *** [ninja_wrapper] Error 1

Solution:
Add swap partition

Read More: