Having enough free memory seems to have solved this weird error.
Compiling the Android platform uses a lot of RAM, sometimes at least 500MB in some instances. My usage shot up from ~500 to ~1000 MB at one point early in the process but settled back down to ~500.