SDK 8.0.0r36 (GNU/Linux, Windows)

Recreate matching build environment

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

Build dependencies

# https://source.android.com/setup/build/initializing
dpkg --add-architecture i386
apt-get update

apt-get -y install wget
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
checksumfile=$(mktemp)
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
EOF
sha256sum $checksumfile || exit "Incorrect checksums"
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
# https://sites.google.com/a/android.com/tools/build  2015-07-23
# TODO: mingw32 is possibly an obsolete dependency moved to prebuilts/
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-8.0.0_r36
time ~/bin/repo sync --current-branch -j4

Build the SDK

export BUILD_NUMBER="user.8.0.0_r36"
. build/envsetup.sh
lunch sdk-user
time make sdk -j$(nproc) showcommands dist sdk_repo

time make win_sdk -j$(nproc) showcommands dist sdk_repo

time make -j$(nproc) PRODUCT-sdk_arm64-sdk  showcommands dist sdk_repo
time make -j$(nproc) PRODUCT-sdk_x86_64-sdk showcommands dist sdk_repo

Results:

-rw-r--r-- 1 android android 647M Dec 14 13:45 out/dist/android-sdk_user.8.0.0_r36_linux-x86.zip
-rw-r--r-- 1 android android 649M Dec 14 14:27 out/dist/android-sdk_user.8.0.0_r36_windows.zip
-rw-r--r-- 1 android android 647M Dec 14 13:45 out/host/linux-x86/sdk/sdk/android-sdk_user.8.0.0_r36_linux-x86.zip
-rw-r--r-- 1 android android 649M Dec 14 14:27 out/host/windows/sdk/sdk/android-sdk_user.8.0.0_r36_windows.zip

-rw-r--r-- 1 android android  894 Dec 15 12:22 out/dist/repo-sys-img.xml
-rw-r--r-- 1 android android 3.6K Dec 15 12:19 out/dist/repository.xml
-rw-r--r-- 1 android android  52M Dec 15 12:19 out/dist/sdk-repo-linux-build-tools-user.8.0.0_r36.zip
-rw-r--r-- 1 android android 106M Dec 15 12:19 out/dist/sdk-repo-linux-docs-user.8.0.0_r36.zip
-rw-r--r-- 1 android android 7.7M Dec 15 12:19 out/dist/sdk-repo-linux-platform-tools-user.8.0.0_r36.zip
-rw-r--r-- 1 android android  61M Dec 15 12:19 out/dist/sdk-repo-linux-platforms-user.8.0.0_r36.zip
-rw-r--r-- 1 android android 123M Dec 15 12:19 out/dist/sdk-repo-linux-samples-user.8.0.0_r36.zip
-rw-r--r-- 1 android android  34M Dec 15 12:19 out/dist/sdk-repo-linux-sources-user.8.0.0_r36.zip
-rw-r--r-- 1 android android 426M Dec 15 12:21 out/dist/sdk-repo-linux-system-images-user.8.0.0_r36.zip
-rw-r--r-- 1 android android  53M Dec 15 02:19 out/dist/sdk-repo-windows-build-tools-user.8.0.0_r36.zip
-rw-r--r-- 1 android android 7.4M Dec 15 02:19 out/dist/sdk-repo-windows-platform-tools-user.8.0.0_r36.zip

TODO

Rebuild the prebuilts/ sub-directories.

Error messages and resolutions

Building system images require the PRODUCT-sdk_XXX-sdk syntax (see SDK):

$ make -j$(nproc) PRODUCT-sdk_x86_64-userdebug sdk showcommands dist sdk_repo
...
build/core/main.mk:436: error: The 'sdk' target may not be specified with any other targets.

Notes

Build result recap

$ JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 tools/bin/sdkmanager --list

Installed packages:
  Path                                         | Version    | Description                       | Location                                
  -------                                      | -------    | -------                           | -------                                 
  build-tools;26.0.1                           | 26.0.1     | Android SDK Build-Tools 26.0.1    | build-tools/android-8.0.0/              
  docs                                         | 1          | Documentation for Android SDK     | docs/                                   
  platform-tools                               | 26.0.0 rc1 | Android SDK Platform-Tools 26 rc1 | platform-tools/                         
  platforms;android-26                         | 2          | Android SDK Platform 26, rev 2    | platforms/android-8.0.0/                
  system-images;android-26;default;armeabi-v7a | 1          | ARM EABI v7a System Image         | system-images/android-8.0.0/armeabi-v7a/

  system-images;android-26;default;arm64-v8a   | 1          | ARM 64 v8a System Image           | system-images/android-8.0.0/arm64-v8a/
  system-images;android-26;default;x86_64      | 1          | Intel x86 Atom_64 System Image    | system-images/android-8.0.0/x86_64/

ccache usage

N/A

build stats

Using i5-6300HQ (4x2.30GHz), SSD disk:

  • make sdk: make completed successfully (02:31:02 (hh:mm:ss))
  • make win_sdk: build completed successfully (42:09 (mm:ss))
  • PRODUCT-sdk_x86_64-sdk: make completed successfully (02:44:24 (hh:mm:ss))
  • du -sh wd/: 149G; +66G for x86_64 system image
  • du -sh wd/.repo/: 27G

Automated build recipe

https://gitlab.com/android-rebuilds/auto/tree/master/sdk-8.0.0