SDK Tools 24.3.4 (GNU/Linux, Windows)

Principle of operation

The Android SDK contains the SDK Tools, which are built from a different source tree than the SDK.

Recreate matching build environment

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

Build dependencies

# JDK v6
apt-get -y install openjdk-6-jdk xz-utils

# Compiles 32-bit C++ programs
# 'emugen' compiled and run as 32-bit
apt-get -y install make binutils patch
apt-get -y install g++-multilib
apt-get -y install zip unzip libxml2-utils  # zip/unzip/zip + xmllint

# Windows build
apt-get -y remove wine  # running testsuite through wine in both 32- and 64-bit is buggy
apt-get -y install pkg-config  # qemu-android for windows
apt-get -y install autoconf automake1.11  # fix warnings

Locating the source

According to the, studio-1.3-release is the current stable version.

studio-1.4-release is actually older than studio-1.3-release, and is probably not published from the internal Android repos as of 2015-09.

Preparing the source tree

Install repo:

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:

~/bin/repo init -u -b studio-1.3-release
# version == 24.3.4 according to 'cd sdk/ && git log' ("Update version from 24.3.3 -> 24.3.4")
#                            and 'sdk/files/'
~/bin/repo sync
# 15mn with good connectivity
# 15GB (inc. 7GB .repo)

Building SDK Tools

# Use JDK6 (not JDK7)

mkdir -p out/dist
time bash -x tools/buildSrc/servers/ `pwd`/out `pwd`/out/dist 0  # doesn't accept 24.3.4 as last argument :/
# Note: if needed for speed-up: remove target 'makeWinSdk' in that script
# 25mn, 20GB (inc. 7GB .repo), no ccache

This results in:

  • out/dist/
  • out/dist/ - smaller (178MB vs. 296MB), because the GNU/Linux build has both lib/ and lib64/, and a larger gles_mesa/

We just compiled Tools > Android SDK Tools 24.3.4!



The build system uses its own:

  • ~/wd/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin/x86_64-linux-gcc
  • ~/wd/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-gcc

at first - cf. external/qemu/android/scripts/

But it still requires compilers and tools from distro. Note: maybe one should export CC=.../prebuits/...

prebuilts/android-emulator-build/mesa/* are directly copied in the resulting archive.

Error messages and resolutions

  • /home/android/wd/external/qemu/android/scripts/ 272: [: glib: unexpected operator

    ⇒ Use bash as default shell (see above)

  • warnings/ignored errors in; about autoheader, pkg-config, automake-1.11, aclocal-1.11, all during the windows part:

    apt-get install autoconf automake1.11

  • 32-bit errors:

    make: /home/android/wd/out/build/emulator/build/default/emugen: Command not found
    /home/android/wd/out/build/emulator/build/default/emugen: error while loading shared libraries: cannot open shared object file: No such file or directory

    ⇒ Missing system 32-bit runtime, apt-get install g++-multilib # including the lib32stdc++6 runtime

  • Missing base C files:

    /home/android/wd/sdk/emulator/mksdcard/src/source/mksdcard.c:33:18: fatal error: time.h: No such file or directory
     #include <time.h>
    In file included from /usr/include/time.h:27:0,
    from /home/android/wd/sdk/emulator/mksdcard/src/source/mksdcard.c:33:
    /usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory

    apt-get install g++-multilib # libc6-dev-i386