Sometimes I want to compile an old version of Android / AOSP / CyanogenMod, so here's a table of which version of Debian I've found works best for a particular version of Android.

Version table

Android to Debian
Android # Android Name CyanogenMod # Debian version Reason
4.0 Ice Cream Sandwich (ICS) 9 Debian 7 JDK 6, GNU Make 3.8.2. Debian 8 has JDK7, Make 4
4.4 KitKat 11 Debian 8 JDK 6/7, Debian 8 has JDK7

Dependencies / Build notes

Android 4.0

Issues

May not compile even in a container:

Certain toolchain programs (notably a linker) will get an "mmap: Operation not permitted". This is probably a kernel restriction introduced with newer kernels. See https://stackoverflow.com/questions/8213671/mmap-operation-not-permitted.

This error was seen on Linux 6.1:

prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: fatal error: out/target/product/gio/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a: mmap offset 49455104 size 155648 failed: Operation not permitted

Dependencies:

apt-get install --yes --force-yes --no-install-recommends bison build-essential curl flex gcc-multilib git g++-multilib gnupg gperf lib32ncurses5-dev lib32z1-dev libesd0-dev libncurses5-dev libswitch-perl libxml2-utils lzop openjdk-6-jdk pngcrush python schedtool squashfs-tools xsltproc zip zlib1g-dev
. build/envsetup
breakfast << DEVICE >>
make -j << THREADS >> bacon

Android 4.4

Issues

Does not seem to present the same linker issue as 4.4 (above). Builds fine under Linux 6.1 on Debian 12 (in a Debian 8 container).

Dependencies:

apt-get install --yes --force-yes --no-install-recommends bc bison build-essential curl file flex gcc-multilib git g++-multilib gnupg gperf lib32ncurses5-dev lib32readline6-dev lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush python schedtool squashfs-tools xsltproc zip zlib1g-dev
. build/envsetup
breakfast << DEVICE >>
make -j << THREADS >> bacon