SDK 11.0.0 (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

# https://source.android.com/setup/build/requirements
# The master branch of Android in AOSP comes with a prebuilt version
# of OpenJDK, so no additional installation is required.

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

# Windows dependencies
# https://sites.google.com/a/android.com/tools/build  2015-07-23
apt-get -y install mingw32 tofrodos

# dist / sys-img dependencies
apt-get -y install python rsync

Prepare source tree

Install repo.

Checkout the source in a recent (Python 3) separate environment:

mkdir ~/wd/
cd ~/wd/
~/bin/repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r27 --depth=1
time ~/bin/repo sync --current-branch -j4
# 21GB .repo - 2h dl + 1/2h checkout

Build the SDK

export BUILD_NUMBER="eng.11.0.0_r27"
. build/envsetup.sh
lunch sdk-eng

#make -j$(nproc) sdk                    dist sdk_repo
make -j$(nproc) win_sdk                dist sdk_repo  # also runs 'sdk'

# System images (preferably with 'lunch sdk-userdebug')
# All these work, commented out for space reasons
#m TARGET_PRODUCT=sdk         sdk  dist sdk_repo
#m TARGET_PRODUCT=sdk_arm64   sdk  dist sdk_repo
#m TARGET_PRODUCT=sdk_x86_64  sdk  dist sdk_repo
#m TARGET_PRODUCT=sdk_x86     sdk  dist sdk_repo

Results:

-rw-r--r-- 1 android android 786M Jan  8 23:18 out/dist/android-sdk_eng.11.0.0_r27_linux-x86.zip
-rw-r--r-- 1 android android 803M Jan  8 23:22 out/dist/android-sdk_eng.11.0.0_r27_windows.zip
-rw-r--r-- 1 android android  899 Jan  8 23:21 out/dist/repo-sys-img.xml
-rw-r--r-- 1 android android 4.7K Jan  8 23:23 out/dist/repository.xml
-rw-r--r-- 1 android android  52M Jan  8 23:18 out/dist/sdk-repo-linux-build-tools-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android  89M Jan  8 23:18 out/dist/sdk-repo-linux-docs-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android 8.5M Jan  8 23:18 out/dist/sdk-repo-linux-platform-tools-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android  50M Jan  8 23:18 out/dist/sdk-repo-linux-platforms-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android 131M Jan  8 23:18 out/dist/sdk-repo-linux-samples-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android  42M Jan  8 23:21 out/dist/sdk-repo-linux-sources-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android 454M Jan  8 23:20 out/dist/sdk-repo-linux-system-images-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android  52M Jan  8 23:22 out/dist/sdk-repo-windows-build-tools-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android 7.6M Jan  8 23:22 out/dist/sdk-repo-windows-platform-tools-eng.11.0.0_r27.zip
-rw-r--r-- 1 android android 786M Jan  8 23:18 out/host/linux-x86/sdk/sdk/android-sdk_eng.11.0.0_r27_linux-x86.zip
-rw-r--r-- 1 android android 803M Jan  8 23:22 out/host/windows/sdk/sdk/android-sdk_eng.11.0.0_r27_windows.zip

TODO

Rebuild the prebuilts/ sub-directories.

packaged x86 system image near-empty (tested with r27 and r31):

#### build completed successfully (06:01:24 (hh:mm:ss)) ####
-rw-r--r-- 1 android android  34M Jan 15 07:11 out/dist/sdk-repo-linux-system-images-userdebug.11.0.0_r27.zip

$ find -name system.img -ls
 11935798 1022696 -rw-r--r-- 1114566656 ./out/target/product/generic_x86/obj/PACKAGING/systemimage_intermediates/system.img
  5259146 1088448 -rw-r--r-- 1114566656 ./out/target/product/generic_x86/system.img
  5654957    3072 -rw-rw-r--    3145728 ./out/host/linux-x86/sdk/sdk_x86/android-sdk_userdebug.11.0.0_r27_linux-x86/system-images/android-11/x86/system.img

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 still complains when run in Docker (cf. SDK 10.0.0).

Notes

Build result recap

r27

$ tools/bin/sdkmanager --list
Installed packages:
  Path                                         | Version | Description                       | Location                             
  -------                                      | ------- | -------                           | -------                              
  build-tools;30.0.3                           | 30.0.3  | Android SDK Build-Tools 30.0.3    | build-tools/android-11/              
  docs                                         | 1       | Documentation for Android SDK     | docs/                                
  platform-tools                               | 29.0.6  | Android SDK Platform-Tools 29.0.6 | platform-tools/                      
  platforms;android-30                         | 3       | Android SDK Platform 30, rev 3    | platforms/android-11/                
  system-images;android-30;default;armeabi-v7a | 1       | ARM EABI v7a System Image         | system-images/android-11/armeabi-v7a/

Available Updates:
  ID             | Installed | Available
  -------        | -------   | -------  
  platform-tools | 29.0.6    | 30.0.5

plus: samples 30.2 (not reported)

Using SDK Tools:

  tools                                        | 26.1.1  | Android SDK Tools 26.1.1          | tools/                               

ccache usage

N/A

build stats

r27, with dist and sdk_repo targets:

  • win_sdk: build completed successfully (08:16:46 (hh:mm:ss))
  • du -sh wd/: 194G
  • du -sh wd/.repo/: 21G

A friendly note:

00:23:08 ************************************************************
00:23:08 You are building on a machine with 15.6GB of RAM
00:23:08 
00:23:08 The minimum required amount of free memory is around 16GB,
00:23:08 and even with that, some configurations may not work.
00:23:08 
00:23:08 If you run into segfaults or other errors, try reducing your
00:23:08 -j value.
00:23:08 ************************************************************

Automated build recipe

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