Build Overview

    Building Android Studio
    Historically, building the Android tools required building the full Android SDK as well, since for example the emulator needed the system image.

    However, we've been gradually migrating the tools source code over to a more independent setup, and you can now build the Android Studio IDE without a full Android checkout and without a C compiler etc. The instructions for building Android Studio are listed in the Building Android Studio page; the remainder of this document documents the process for building the rest of the tools (the Eclipse plugin, the emulator, etc.)

    Building the Android Gradle Plugin
    For instructions, see Building the Android Gradle Plugin.


    First, you'll need to install the prerequisites for your platform. This means you'll have git, a C compiler, etc. There are quite a few steps here, and it's all platform dependent, so go to the official build instructions where we have detailed instructions:

    Pay careful attention. For example, on a Mac you will need to work on a case-sensitive filesystem image, which is not the OSX default. One other Mac specific tip, which is not in the main Android page yet, is that Apple's recent JDK update "broke" the Android build on Snow Leopard since the build uses JNI. The location of the JNI header file changed or disappeared with the JDK update, so you now need to go to Apple and get the developer SDK, JavaDeveloper.pkg from

    Once you have everything configured, check out the source code using the following commands in a bash shell:

    $ mkdir android
    $ cd android
    $ repo init -u
    $ repo sync

    The default repo init command will checkout a lot of items that you may not want. Here's a list of packages that have their own group name, allowing you to decide if you want them or not.
     tools Packages for dev tools that are not part of the default downloads notdefault
     device Packages to build devices supported by AOSP (for instance Nexus devices) default
     arm Packages to build ARM system images default
     mips Packages to build MIPS system images default
     x86 Packages to build x86 system images default
     linux cross-compiler used on Linux host default
     darwin cross-compiler used on MacOS X host default
     eclipse Packages used to build Eclipse notdefault
     motodev Motodev plugins notdefault

    By default, only the default packages are downloaded. You can add optional (notdefault) packages, and you can also omit default packages that have their own.
    This is done with the -g option. Omitting this option is the same as doing
    -g all,-notdefault

    For instance, downloading the tree to work on ARM system image for the emulator only from a linux workstation you can do:
    repo init -u ... -g all,-notdefault,-device,-mips,-x86,-darwin

    To work only on the developer tools, and build the Eclipse bundle from a MacOS X desktop,  you can do:
    repo init -u ... -g all,-notdefault,-device,-arm,-mips,-x86,-linux,eclipse

    In the future we hope to reduce this to: -g tools,eclipse by decoupling the tools from the platform build system

    To build Android Studio, you should be able to use these groups:
        repo init -u -g tools,pdk

    Note: at any time after an initial repo init/sync, you can update the list of packages you need by running
    repo init -g <packages>
    repo sync
    Existing packages that are not needed will be removed, restoring storage space.

    During the repo init command, it will ask you for your name and e-mail address; these will be used later if you decide to check in changesets and upload them for review.

    For full, up to date instructions please look at

    Builing the Linux and MacOS SDK

    Now you are ready to build. While you could just type "make", this is where our SDK build instructions diverge a bit from the default build.

    In a bash shell, run these commands:

    $ . build/
    $ lunch sdk-eng
    $ make sdk

    That will run for quite a while and build a full SDK. The result is located at

    Building the Windows SDK

    Full Windows SDK builds are only supported on Linux -- most of the framework is not designed to be built on Windows so technically the Windows SDK is build on top of a Linux SDK where a few binaries are replaced.

    $ sudo apt-get install mingw32 tofrodos

    mingw32 is the cross-compiler, tofrodos adds a unix2dos command

    To build:

    $ . build/
    $ lunch sdk-eng
    $ make win_sdk

    Note that this will build both a Linux SDK then a Windows SDK. The result is located at

    Next steps

    The next step is preparing your setup depending on which project you want to work on:
    • To set up your Eclipse environment to build, edit and debug the Eclipse plug-ins for Android, see the "Building the Eclipse-Based Tools" document.
    • Traceview, Hierarchy Viewer and DDMS are all setup as follows:
      • The core logic resides in the Java projects under sdk/traceview, sdk/hierarchyviewer2 and sdk/ddms respectively. Import these projects into Eclipse.
      • The above projects generate jar files that are then referenced by their corresponding plugins. traceview-plugin, hierarchyviewer-plugin and ddms-plugin, all of which are present under sdk/eclipse/plugins.
    • TODO: add instructions to work on emulator.