SDK 1.6 (GNU/Linux)

Recreate matching build environment

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

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:

mkdir ~/wd/
cd ~/wd/
~/bin/repo init -u -b android-1.6_r2
time ~/bin/repo sync --current-branch -j4
# 8.9GB .repo

Build the SDK

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


-rw-r--r-- 1 android android 111M Jul  9 11:20 out/dist/
-rw-r--r-- 1 android android 111M Jul  9 11:20 out/host/linux-x86/sdk/


Rebuild the prebuilts/ sub-directories.

Error messages and resolutions

/usr/bin/ld: skipping incompatible /usr/lib/libX11.a when searching for -lX11
/usr/bin/ld: cannot find -lX11

Requires Ubuntu 32-bit. Possible work-around:

host layoutlib_create: out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar
java -jar out/host/common/obj/JAVA_LIBRARIES/layoutlib_create_intermediates/javalib.jar \
                 out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar \
                 out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar \
Output: out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar
Input :      out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar
Input :      out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
make: *** [out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar] Error 1
make: *** Waiting for unfinished jobs....

=> apt-get install unzip + restart the build from scratch

Missing unzip causes non-fatal errors where the build fails to unzip existing .jar dependencies for re-bundling in new jars.


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-4 | 2       | Android SDK Platform 4, rev 2 | platforms/android-1.6/
  tools               | 2.0.0   | Android SDK Tools 2           | tools/                

build stats

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

  • sdk: 13mn
  • du -sh wd/: 15G
  • du -sh wd/.repo/: 8.9G

Automated build recipe