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: http://source.android.com/source/initializing.html.
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 http://connect.apple.com.
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 https://android.googlesource.com/platform/manifest
$ 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.
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
For instance, downloading the tree to work on ARM system image for the emulator only from a linux workstation you can do:
To work only on the developer tools, and build the Eclipse bundle from a MacOS X desktop, you can do:
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:
Note: at any time after an initial repo init/sync, you can update the list of packages you need by running
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 http://source.android.com/source/downloading.html.
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/envsetup.sh
$ 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.
$ . build/envsetup.sh
$ lunch sdk-eng
Note that this will build both a Linux SDK then a Windows SDK. The result is located at
The next step is preparing your setup depending on which project you want to work on: