Skip to content

Instantly share code, notes, and snippets.

@verNANDo57
Created March 18, 2022 06:53
Show Gist options
  • Select an option

  • Save verNANDo57/9c14d529d91e79f3b42fa6bd7b9eba85 to your computer and use it in GitHub Desktop.

Select an option

Save verNANDo57/9c14d529d91e79f3b42fa6bd7b9eba85 to your computer and use it in GitHub Desktop.
Workarounds for building Android 12 on 8GB RAM
Workarounds for building S on 8GB RAM environment:
1. At the start of the build:
[ 99% 138/139] /mnt/ssd/lineage/out/soong/.bootstrap/bin/soong_build /mnt/ssd/lineage/out/soong/build.ninja
This used to take around 30mins, after enabling zram now it takes around 30secs (thanks to @kdrag0n for the zram idea) which is on par with what happens in 16GB RAM building environments
sudo apt install zram-config for installing zram-config package
sudo nano /etc/fstab and add a # in front of the swap disk if you have one and then reboot
After booting cat /proc/swaps to check if zram is enabled or not
2. To avoid issues while building metalava (outOfMemoryException: java heap space)
Pick this commit --> https://github.com/verNANDo57/android_build_soong/commit/ffc8846a01fcfc20d6cf8ca701ef73d99f15acad
@Niyush-04
Copy link

will this work for android 13?

@verNANDo57
Copy link
Author

will this work for android 13?

I don't think so, try searching guide for A13.

@PowerX-NOT
Copy link

will this work for android 13?

WELL my friend built los 20 with 8gb ram + 36gb zram (fedora)

@Niyush-04
Copy link

will this work for android 13?

I don't think so, try searching guide for A13.

Yupp these things are still working just have to increase Java max heap size limit by 1gb more.

@chunix64
Copy link

chunix64 commented Aug 16, 2025

I made this script and have the same problem, but google colab has disabled swap feature (no tricks can bypass). Can I fix bootstrap out of ram? (12GB ram)

https://colab.research.google.com/github/chunix64/jupyter-orangefox-builder/blob/main/orangefox-builder.ipynb#scrollTo=CEtBup4iuOso

@chunix64
Copy link

Solved:
Free ssh server for android building with 16gb ram + swap

https://github.com/chunix64/github-action-ssh

@mesziman
Copy link

Solved: Free ssh server for android building with 16gb ram + swap

https://github.com/chunix64/github-action-ssh

Is the disksize enough for that?

@chunix64
Copy link

chunix64 commented Nov 27, 2025

Solved: Free ssh server for android building with 16gb ram + swap
https://github.com/chunix64/github-action-ssh

Is the disksize enough for that?

Enough for boot, recovery, vendor_boot building but not for system.img

Try "distributed build system", idk if it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment