[Android Software Development] Danksh:
I'm trying to compile android for the first time. I'm using Ubuntu 18.10 x64. I'm attempting to build Android x86_64 Oreo (I also attempted a couple other of their branches with the same problem).

ninja: build stopped: subcommand failed.

06:50:54 soong failed with: exit status 1

I've searched the forums and googled for a few hours. I installed some new software and added environment variables suggested by different threads, but nothing seems to get me past this error.

Full Output:

individual@individual:/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android$ m -j2 iso_img
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.1.0
TARGET_PRODUCT=android_x86_64
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.18.0-10-generic-x86_64-with-Ubuntu-18.10-cosmic
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OPM8.181005.003
OUT_DIR=out
============================================
ninja: no work to do.
[1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -b out/soong -d out/soong/build.ninja.d -o out/soong/build.ninja Android.bp
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x8107e2, 0x16)
prebuilts/go/linux-x86/src/runtime/panic.go:596 +0x95
runtime.sysMap(0xc4dd210000, 0x45ae0000, 0x116b6000, 0xa2dd78)
prebuilts/go/linux-x86/src/runtime/mem_linux.go:216 +0x1d0
runtime.(*mheap).sysAlloc(0xa15be0, 0x45ae0000, 0x7ff520cf1800)
prebuilts/go/linux-x86/src/runtime/malloc.go:428 +0x374
runtime.(*mheap).grow(0xa15be0, 0x22d6b, 0x0)
prebuilts/go/linux-x86/src/runtime/mheap.go:774 +0x62
runtime.(*mheap).allocSpanLocked(0xa15be0, 0x22d6b, 0x1)
prebuilts/go/linux-x86/src/runtime/mheap.go:678 +0x44f
runtime.(*mheap).alloc_m(0xa15be0, 0x22d6b, 0x100000000, 0x0)
prebuilts/go/linux-x86/src/runtime/mheap.go:562 +0xe2
runtime.(*mheap).alloc.func1()
prebuilts/go/linux-x86/src/runtime/mheap.go:627 +0x4b
runtime.systemstack(0xc4208e7f10)
prebuilts/go/linux-x86/src/runtime/asm_amd64.s:343 +0xab
runtime.(*mheap).alloc(0xa15be0, 0x22d6b, 0x10100000000, 0xc4200001a0)
prebuilts/go/linux-x86/src/runtime/mheap.go:628 +0xa0
runtime.largeAlloc(0x45ad5152, 0x450401, 0x10000c4203dac30)
prebuilts/go/linux-x86/src/runtime/malloc.go:795 +0x93
runtime.mallocgc.func1()
prebuilts/go/linux-x86/src/runtime/malloc.go:690 +0x3e
runtime.systemstack(0xc42002f300)
prebuilts/go/linux-x86/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
prebuilts/go/linux-x86/src/runtime/proc.go:1132

goroutine 1 [running]:
runtime.systemstack_switch()
prebuilts/go/linux-x86/src/runtime/asm_amd64.s:281 fp=0xc443151410 sp=0xc443151408
runtime.mallocgc(0x45ad5152, 0x77c5a0, 0x821801, 0xc4dd01f0d0)
prebuilts/go/linux-x86/src/runtime/malloc.go:691 +0x930 fp=0xc4431514b0 sp=0xc443151410
runtime.makeslice(0x77c5a0, 0x45ad5152, 0x45ad5152, 0x441657, 0x34398539fc8, 0x0)
prebuilts/go/linux-x86/src/runtime/slice.go:54 +0x7b fp=0xc443151500 sp=0xc4431514b0
bytes.makeSlice(0x45ad5152, 0x0, 0x0, 0x0)
prebuilts/go/linux-x86/src/bytes/buffer.go:201 +0x77 fp=0xc443151540 sp=0xc443151500
bytes.(*Buffer).grow(0xc452d54c40, 0x96, 0x450401)
prebuilts/go/linux-x86/src/bytes/buffer.go:109 +0x177 fp=0xc443151590 sp=0xc443151540
bytes.(*Buffer).WriteString(0xc452d54c40, 0xc475b96c80, 0x96, 0x7ff52119ebb8, 0xc452d54c40, 0x1)
prebuilts/go/linux-x86/src/bytes/buffer.go:146 +0x41 fp=0xc4431515c0 sp=0xc443151590
io.WriteString(0x9f17a0, 0xc452d54c40, 0xc475b96c80, 0x96, 0x96, 0x0, 0x0)
prebuilts/go/linux-x86/src/io/io.go:289 +0x76 fp=0xc443151608 sp=0xc4431515c0
github.com/google/blueprint.(*ninjaWriterWithWrap).writeString(0xc4431516c0, 0xc475b96c80, 0x96, 0xc4dd01f001)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/ninja_writer.go:238 +0x8b fp=0xc443151658 sp=0xc443151608
github.com/google/blueprint.(*ninjaWriterWithWrap).WriteStringWithSpace(0xc4431516c0, 0xc475b96c80, 0x96)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/ninja_writer.go:247 +0x44 fp=0xc443151688 sp=0xc443151658
github.com/google/blueprint.(*ninjaWriter).Build(0xc427f505a0, 0x0, 0x0, 0xc4dd01f016, 0x7, 0xc4dd01f0a0, 0x1, 0x1, 0xa2cf98, 0x0, ...)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/ninja_writer.go:157 +0x21c fp=0xc4431516f8 sp=0xc443151688
github.com/google/blueprint.(*buildDef).WriteTo(0xc475a23440, 0xc427f505a0, 0xc46d740f30, 0xc44db9ac00, 0x59)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/ninja_defs.go:375 +0x3aa fp=0xc443151ac8 sp=0xc4431516f8
github.com/google/blueprint.(*Context).writeLocalBuildActions(0xc420108280, 0xc427f505a0, 0xc4344ce720, 0x0, 0x0)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/context.go:3152 +0x2bc fp=0xc443151b60 sp=0xc443151ac8
github.com/google/blueprint.(*Context).writeAllModuleActions(0xc420108280, 0xc427f505a0, 0x0, 0x0)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/context.go:3036 +0x923 fp=0xc443151d10 sp=0xc443151b60
github.com/google/blueprint.(*Context).WriteBuildFile(0xc420108280, 0x9f17a0, 0xc452d54c40, 0x87f, 0xc46dad2000)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/context.go:2712 +0x19a fp=0xc443151d48 sp=0xc443151d10
github.com/google/blueprint/bootstrap.Main(0xc420108280, 0x7fc040, 0xc42007c580, 0xc420409f58, 0x2, 0x2)
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/blueprint/bootstrap/command.go:150 +0x73e fp=0xc443151ed0 sp=0xc443151d48
main.main()
/media/individual/66d2ccb6-7fc1-4c9d-aa2e-abb553bf4ca3/android/build/soong/cmd/soong_build/main.go:48 +0x235 fp=0xc443151f88 sp=0xc443151ed0
runtime.main()
prebuilts/go/linux-x86/src/runtime/proc.go:185 +0x20a fp=0xc443151fe0 sp=0xc443151f88
runtime.goexit()
prebuilts/go/linux-x86/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc443151fe8 sp=0xc443151fe0
ninja: build stopped: subcommand failed.
06:50:54 soong failed with: exit status 1

#### failed to build some targets (07:40:37 (hh:mm:ss)) ####

Any help would be greatly appreciated.