SDK 2.2 (GNU/Linux)

Recreate matching build environment

The build environment for this version is Ubuntu 8.04 (although it was officially Dapper).

Build dependencies

apt-get update

wget --quiet
wget --quiet
wget --quiet
wget --quiet
cat <<'EOF' > $checksumfile
daf602b142c1125eb65126c6bfd416e6d56cb17a98e755a881251646abfc3240  sun-java5-jdk_1.5.0-22-0ubuntu0.8.04_i386.deb
89866c3c359e71a14d90a6e851c9a09b941a768359fa1e3fdb973c7a8f850f5d  sun-java5-jre_1.5.0-22-0ubuntu0.8.04_all.deb
632ae901139246b829d2493b94f22a030f35dac604bb27d71f4b4bc3355695a5  sun-java5-bin_1.5.0-22-0ubuntu0.8.04_i386.deb
2e9a98d504831e7f9abee71a77c70e8c1de7b5d335dad540fe30311e3ff0e287  sun-java5-demo_1.5.0-22-0ubuntu0.8.04_i386.deb
sha256sum -c $checksumfile || exit 1

dpkg -i \
  sun-java5-jdk_1.5.0-22-0ubuntu0.8.04_i386.deb \
  sun-java5-jre_1.5.0-22-0ubuntu0.8.04_all.deb \
  sun-java5-bin_1.5.0-22-0ubuntu0.8.04_i386.deb \
  sun-java5-demo_1.5.0-22-0ubuntu0.8.04_i386.deb \
  || true
apt-get -y -f install

apt-get install -y git-core gnupg flex bison gperf build-essential zip \
  curl zlib1g-dev libc6-dev libncurses5-dev \
  x11proto-core-dev libx11-dev libreadline5-dev libz-dev \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  libxml2-utils xsltproc unzip

Prepare source tree

Install repo. Due to its recent dependencies (git, python, SSL certificates, SSL digest algorithms), this phase is done with Ubuntu 14.04.

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:

Using 2.2_r1 instead of latest 2.2.3_r2.1, as 2.2_r1 does not depend on a prebuilt SDK8.

mkdir ~/wd/
cd ~/wd/
~/bin/repo init -u -b android-2.2_r1
time ~/bin/repo sync --current-branch -j4
# 12GB .repo

Replace SDK prebuilts:

rm -rf prebuilt/sdk/{5,6,7,8,tools}/

# $ grep -r 'LOCAL_SDK_VERSION := ' . | grep -v current$
# ./packages/experimental/BugReportSender/ := 4
rm -f prebuilt/sdk/4/android.jar
curl \
  > prebuilt/sdk/4/android.jar
rm -f prebuilt/sdk/4/framework.aidl
curl \
  > prebuilt/sdk/4/framework.aidl

Build the SDK

export BUILD_NUMBER="userdebug.2.2_r1"
. build/
lunch sdk-userdebug
time make sdk -jXX showcommands dist


-rw-r--r-- 1 android android 164M Jul 15 17:03 out/dist/
-rw-r--r-- 1 android android 164M Jul 15 17:03 out/host/linux-x86/sdk/


Rebuild the prebuilts/ sub-directories.

Error messages and resolutions

build/core/ *** packages/apps/QuickSearchBox: Invalid LOCAL_SDK_VERSION '8' Choices are: current 4.  Stop.

=> try with 2.2_r1

win_sdk available for the first time but seems to fail:
host C: sqlite3 <= external/sqlite/dist/shell.c
external/sqlite/dist/shell.c:42:32: error: readline/readline.h: No such file or directory
external/sqlite/dist/shell.c:43:31: error: readline/history.h: No such file or directory
external/sqlite/dist/shell.c: In function 'one_input_line':
external/sqlite/dist/shell.c:1241: warning: implicit declaration of function 'readline'
external/sqlite/dist/shell.c:1241: warning: assignment makes pointer from integer without a cast
external/sqlite/dist/shell.c:1243: warning: implicit declaration of function 'add_history'
external/sqlite/dist/shell.c: In function 'main':
external/sqlite/dist/shell.c:3548: warning: implicit declaration of function 'read_history'
external/sqlite/dist/shell.c:3552: warning: implicit declaration of function 'stifle_history'
external/sqlite/dist/shell.c:3553: warning: implicit declaration of function 'write_history'
make[1]: *** [out/host/windows-x86/obj/EXECUTABLES/sqlite3_intermediates/shell.o] Error 1

=> not sure, libreadline5-dev was installed, first windows builds so maybe some manual fixes still needed from this rev.


Build result recap

$ JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 tools/bin/sdkmanager --list
Installed packages:
  Path                | Version | Description                   | Location              
  -------             | ------- | -------                       | -------               
  docs                | 1       | Documentation for Android SDK | docs/                 
  platforms;android-8 | 2       | Android SDK Platform 8, rev 2 | platforms/android-2.2/
  tools               | 6.0.0   | Android SDK Tools 6           | tools/                

Available Updates:
  ID                  | Installed | Available
  -------             | -------   | -------  
  platforms;android-8 | 2         | 3        

build stats

r1, using i5-6300HQ (4x2.30GHz), SSD disk, with dist target:

  • sdk: 18mn
  • du -sh wd/: 20G
  • du -sh wd/.repo/: 12G

Automated build recipe