Preparing AOSP build environment

From Snowdroid Wiki
Revision as of 07:54, 7 July 2025 by Tretdm (talk | contribs) (Created page with "== System requirements == The build can be performed on '''x64-based Linux and macOS PCs''', as well as on Linux virtual machines. The system requirements are recommended to ensure a smooth build process. === Android 5.0-6.0 === * 2 CPU cores * 160 GB of free storage space * 6 GB RAM === Android 7.0-8.1 === * 4 CPU cores * 180 GB of free storage space * 10 GB RAM == Installing required packages for Android 5.0-6.0 == First, install the packages if you are using any...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

System requirements

The build can be performed on x64-based Linux and macOS PCs, as well as on Linux virtual machines. The system requirements are recommended to ensure a smooth build process.

Android 5.0-6.0

  • 2 CPU cores
  • 160 GB of free storage space
  • 6 GB RAM

Android 7.0-8.1

  • 4 CPU cores
  • 180 GB of free storage space
  • 10 GB RAM

Installing required packages for Android 5.0-6.0

First, install the packages if you are using any of the three suggested Linux distributions.

Ubuntu 14.04 LTS

sudo apt-get install git-core gnupg flex bison gperf \
                     build-essential zip curl zlib1g-dev libc6-dev-i386 \ 
                     libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev \
                     lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip \
                     libssl-dev zlib1g-dev xz-utils wget python2.7 openjdk-7-jdk \
                     libc++-dev lib32stdc++6

openSUSE 13.2

sudo zypper in -t pattern 32bit
sudo zypper in gcc glibc-devel-32bit ncurses-devel-32bit \ 
               readline-devel-32bit libpth20-32bit java-1_7_0-openjdk \
               openssl-devel curl-devel libexpat-devel \
               java-1_7_0-openjdk-devel make mawk m4 gperf flex bison \
               gettext-tools 
sudo zypper remove patterns-openSUSE-minimal_base-conflicts
sudo zypper in zip python-xml python-xmldiff python-wheel \
               python-six python-pytz python-pysqlite python-pygit2 \
               python-pycparser python-functional python-async \ 
               python-extras libcurl4-openssl-dev

Debian 8.11.0

sudo apt-get install ia32-libs ia32-libs-dev \
                     openjdk-7-jre openjdk-7-jdk gcc g++ make \
                     libgl1-mesa-dev libgl1-mesa-glx libssl-dev libffi-dev \
                     libcurl4-openssl-dev gettext gnupg flex bison \
                     build-essential zip curl libc6-dev libncurses5-dev \
                     x11proto-core-dev libx11-dev libreadline6-dev \
                     mingw32 tofrodos python-markdown libxml2-utils xsltproc \
                     zlib1g-dev gperf libc6-dev-i386 lib32z1-dev gcc-multilib \
                     g++-multilib lib32ncurses5-dev

Installing required packages for Android 7.0-8.1

Android, starting with version 7.0, uses OpenJDK 8, so the sequence of installing preparatory packages on Ubuntu and Debian is slightly different.

Ubuntu 14.04 LTS

sudo apt-get install git-core gnupg flex bison gperf \
                  build-essential zip curl zlib1g-dev libc6-dev-i386 \ 
                  libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev \
                  lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip \
                  libssl-dev zlib1g-dev xz-utils wget python2.7 \
                  libc++-dev lib32stdc++6
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre-headless_8u45-b14-1_amd64.deb
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u45-b14-1_amd64.deb
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u45-b14-1_amd64.deb
sudo dpkg -i ./openjdk-8-*.deb

openSUSE 13.2

sudo zypper in -t pattern 32bit
sudo zypper in gcc glibc-devel-32bit ncurses-devel-32bit \ 
               readline-devel-32bit libpth20-32bit \
               openssl-devel curl-devel libexpat-devel \
               make mawk m4 gperf flex bison gettext-tools 
sudo zypper remove patterns-openSUSE-minimal_base-conflicts
sudo zypper in zip python-xml python-xmldiff python-wheel \
               python-six python-pytz python-pysqlite python-pygit2 \
               python-pycparser python-functional python-async \ 
               java-1_8_0-openjdk java-1_8_0-openjdk-devel \
               python-extras libcurl4-openssl-dev

Debian 8.11.0

sudo apt-get install ia32-libs ia32-libs-dev \
                  gcc g++ make \
                  libgl1-mesa-dev libgl1-mesa-glx libssl-dev libffi-dev \
                  libcurl4-openssl-dev gettext gnupg flex bison \
                  build-essential zip curl libc6-dev libncurses5-dev \
                  x11proto-core-dev libx11-dev libreadline6-dev \
                  mingw32 tofrodos python-markdown libxml2-utils xsltproc \
                  zlib1g-dev gperf libc6-dev-i386 lib32z1-dev gcc-multilib \
                  g++-multilib lib32ncurses5-dev
su -c "echo deb http://archive.debian.org/debian jessie-backports main > /etc/apt/sources.list.d/jessie-backports.list"
sudo apt-get install openjdk-8-jdk

Installing components for Repo Launcher

To work with the Repo Launcher utility, you need to compile its components from source:

Troubleshooting

Jack server stops at Building with Jack: .../org.apache.http.legacy_intermediates/classes.jack

Reason

This is due to the fact that Jack allocates 4 GB by default for building components, which may not be enough for a full-fledged Android 8.x build.

Solution

1. Enable the JACK_SERVER_VM_ARGUMENTS variable in your ~/.bashrc file and manually via terminal:

export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx10g"

2. Restart Jack server:

jack-admin kill-server
jack-admin start-server