SDK 5.1.1r37 (GNU/Linux, Windows)

Recreate matching build environment

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

Build dependencies

# http://source.android.com/source/initializing.html + fixes
dpkg --add-architecture i386
apt-get update
apt-get -y install openjdk-7-jdk
apt-get -y install bison git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip unzip
apt-get -y install g++-multilib

# Windows dependencies
# https://sites.google.com/a/android.com/tools/build  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 https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

# avoid prompts
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git config --global color.ui true

Checkout the source:

mkdir ~/wd/
cd ~/wd/
~/bin/repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r37
~/bin/repo sync
# 15mn with very good connection
# 36GB (inc. 22GB .repo, from scratch) # for r24

Build the SDK

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

. build/envsetup.sh
lunch sdk-eng
make sdk -j$(nproc)
# 70GB (inc. 22GB .repo), 6.6GB cache size, 8GB RAM direly needed during the 'docdroid' phase # for r24
# => out/host/linux-x86/sdk/sdk/android-sdk_eng.android_linux-x86.zip

make win_sdk -j$(nproc)
# 76GB (inc. 22GB .repo), ccache untouched # for r24
# 90GB (inc. 35GB .repo) # for r37
# => out/host/windows/sdk/sdk/android-sdk_eng.android_windows.zip

TODO

SDK Samples update

update available r6:

"Generated at Tue May 28 14:48:43 2015 from git_lmp-mr1-ub-dev @ 1966220"

presumably from platform/development and/or developers/samples/android.

Release number in development/samples/samples_source.prop_template but I can't find a Pkg.Revision=2 commit??

Notes

Build result recap

  • Tools/
    • [missing] Android SDK Tools
    • Android SDK Platform-tools 22 (23.0.1 available, before Android 6.0 was released)
    • Android SDK Build-tools 22.1.3 (23.0.1 available, before Android 6.0 was released)
  • Android 5.1.1 (API 22)/
    • Documentation for Android SDK 22r1
    • SDK Platform 22r1 (update available r2??)
    • Samples for SDK 22r5 (update available r6??)
    • ARM EABI v7a System Image 22r1
  • Extras/
    • [missing] Android Support Repository 19
    • Android Support Library 22.0.3 (update available 23.0.1??)

No version changes from r18 to r24, source code for revision updates still not located.

ccache usage

$ prebuilts/misc/linux-x86/ccache/ccache -s
cache directory                     /home/android/.ccache
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                         21423
called for link                      438
preprocessor error                  1159
unsupported source language          526
files in cache                     66268
cache size                           6.6 Gbytes
max cache size                      20.0 Gbytes

$ prebuilts/misc/linux-x86/ccache/ccache -s
cache directory                     /home/android/.ccache
cache hit (direct)                 21359
cache hit (preprocessed)              61
cache miss                         21426
called for link                      876
preprocessor error                  2318
unsupported source language         1052
files in cache                     66382
cache size                           6.6 Gbytes
max cache size                      20.0 Gbytes

build time

Using 4xcore, SSH disk:

  • make sdk: 1h45mn
  • make sdk rebuilt using 6.6GB ccache: 45mn
  • make win_sdk: 0h05mn

Using i7-4500U (2x1.80GHz + HT), SSD disk:

  • make sdk: 04h25mn
  • make win_sdk: 0h10mn