SDK 10.0.0 (GNU/Linux, Windows)

Recreate matching build environment

The current reference build environment for this version is Ubuntu 14.04.

Build dependencies

dpkg --add-architecture i386
apt-get update

apt-get -y install wget
cat <<'EOF' > $checksumfile
0f5aba8db39088283b51e00054813063173a4d8809f70033976f83e214ab56c0  openjdk-8-jre-headless_8u45-b14-1_amd64.deb
SHA256 9ef76c4562d39432b69baf6c18f199707c5c56a5b4566847df908b7d74e15849  openjdk-8-jre_8u45-b14-1_amd64.deb
SHA256 6e47215cf6205aa829e6a0a64985075bd29d1f428a4006a80c9db371c2fc3c4c  openjdk-8-jdk_8u45-b14-1_amd64.deb
sha256sum -c $checksumfile || exit 1
dpkg -i openjdk-8-jdk_8u45-b14-1_amd64.deb \
  openjdk-8-jre-headless_8u45-b14-1_amd64.deb \
  openjdk-8-jre_8u45-b14-1_amd64.deb || true
apt-get -y -f install

apt-get -y install git-core gnupg flex bison gperf build-essential zip \
  curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
  lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev \
  libgl1-mesa-dev libxml2-utils xsltproc unzip

# TODO: are hose still necessary?
apt-get -y install python-networkx
apt-get -y install zlib1g-dev:i386

# Windows dependencies
#  2015-07-23
apt-get -y install mingw32 tofrodos

Prepare source tree

Install repo:

sudo apt-get install curl ca-certificates git python
mkdir ~/bin/
curl > ~/bin/repo
chmod a+x ~/bin/repo

# avoid prompts
git config --global ""
git config --global "Your Name"
git config --global color.ui true

Checkout the source:

mkdir ~/wd/
cd ~/wd/
~/bin/repo init -u -b android-10.0.0_r14
time ~/bin/repo sync --current-branch -j4
# 41GB .repo

Build the SDK

# Optional: reserve 10GB for ccache if you're investigating how to build or patching something
# Cf.
#export USE_CCACHE=1
#prebuilts/misc/linux-x86/ccache/ccache -M 10G

export BUILD_NUMBER="eng.10.0.0_r14"
. build/
lunch sdk-eng

#time make sdk -j$(nproc) dist sdk_repo
time make win_sdk -j$(nproc) dist sdk_repo  # also runs 'sdk'
# For specific system images:
time make -j$(nproc) PRODUCT-sdk-sdk  dist sdk_repo
time make -j$(nproc) PRODUCT-sdk_arm64-sdk  dist sdk_repo
time make -j$(nproc) PRODUCT-sdk_x86_64-sdk dist sdk_repo


-rw-r--r-- 1 android android 786M Nov 12 05:26 out/dist/
-rw-r--r-- 1 android android 800M Nov 12 05:29 out/dist/
-rw-r--r-- 1 android android 786M Nov 12 05:25 out/host/linux-x86/sdk/sdk/
-rw-r--r-- 1 android android 800M Nov 12 05:29 out/host/windows/sdk/sdk/


Rebuild the prebuilts/ sub-directories.

Error messages and resolutions

Prepare a LOT of disk space.

Consider adding a swap file; with -j4, even with 16GB, compilation crashes near the end due to multiple memory-hungry processes and JVM can't allocate enough memory.

dd if=/dev/zero of=/swapfile1 bs=4096 count=4194304
chmod 600 /swapfile1
mkswap /swapfile1
swapon /swapfile1

The build system complains when run in Docker:

10:20:58 Build sandboxing disabled due to nsjail error. This may become fatal in the future.
10:20:58 Please let us know why nsjail doesn't work in your environment at:

From!topic/android-building/cDryJWnJN34: The nsjail error isn't fatal currently, but that's something we'd like to change in the future (so that we can get better sandboxing within the build and ensure reproducible/incremental builds work, etc). You may need to tweak some of the settings w/LXC in order to allow nsjail to function, I haven't used it. I know Docker has some known issues currently in which it can't be configured to allow nsjail, but I'm hopeful that that will get fixed.


Build result recap


$ tools/bin/sdkmanager --list
Installed packages:
  Path                                         | Version | Description                       | Location                             
  -------                                      | ------- | -------                           | -------                              
  build-tools;29.0.2                           | 29.0.2  | Android SDK Build-Tools 29.0.2    | build-tools/android-10/              
  docs                                         | 1       | Documentation for Android SDK     | docs/                                
  platform-tools                               | 28.0.2  | Android SDK Platform-Tools 28.0.2 | platform-tools/                      
  platforms;android-29                         | 3       | Android SDK Platform 29, rev 3    | platforms/android-10/                
  system-images;android-29;default;arm64-v8a   | 6       | ARM 64 v8a System Image           | system-images/android-10/arm64-v8a/  
  system-images;android-29;default;armeabi-v7a | 6       | ARM EABI v7a System Image         | system-images/android-10/armeabi-v7a/
  system-images;android-29;default;x86_64      | 6       | Intel x86 Atom_64 System Image    | system-images/android-10/x86_64/     

Available Updates:
  ID                                      | Installed | Available
  -------                                 | -------   | -------  
  platform-tools                          | 28.0.2    | 29.0.5   
  system-images;android-29;default;x86_64 | 6         | 7        

plus: samples 29.2 (not reported)

Using SDK Tools:

  tools                                        | 26.1.1     | Android SDK Tools 26.1.1          | tools/                         

ccache usage


build stats

r14, with dist and sdk_repo targets:

  • win_sdk: build completed successfully (06:12:44 (hh:mm:ss))
  • du -sh wd/: 191G
  • du -sh wd/.repo/: 41G

Automated build recipe