If you haven’t already done so, download the Android Studio source code so that you have a local copy of the following projects:
To learn how to build the Android plugin for Gradle from source, read The Android Gradle plugin.
In order to successfully build Android Studio from source, you’ll need to make sure that you’re able to run the revision-controlled executable of Bazel that's located in the
$ cd studio-main/ $ tools/base/bazel/bazel version Build label: … Build target: … …
To make sure Bazel can execute Android Studio build tasks, try running the following command:
$ bazel build <studio-main>/tools/adt/idea/android:profiler-artifacts
To learn more about running Bazel (including running tests), read Building Studio with Bazel.
If you're on Windows, you need to complete the following steps before you build AS from the command-line:
Install Python 2.7 or higher: Ensure you have Python installed on your windows machine, and the path to
python.exe is added to your
PATH environment variable. Note: It is recommend you use the 64-bit version, although the 32-bit version should work fine.
Install msys2: When building Android Studio, Bazel expects to find msys2 installed at
c:\tools\msys2\. Otherwise, you get a build error.
Install Visual Studio 2015 build tools: Otherwise, you get a build error.
Install Git for Windows: If you haven’t already done so, download and install Git for Windows (64-bit):
C:> git config --global core.longpaths true
C:> set PATH=%PATH%; %LOCALAPPDATA%\Programs\Git;%LOCALAPPDATA%\Programs\Git\Cmd;%LOCALAPPDATA%\Programs\Git\usr\bin;%USERPROFILE%\bin
Download and install git-repo and include it in your
PATH environment variable.
Download the Android SDK. You can do this in one of two ways:
If you are interested in making changes to the Android Studio codebase and building the IDE from source, you can do so using IntelliJ. To begin, you need to first configure a new project from the Android Studio source code, as follows:
<studio-main>/tools/idea/and click OK.
<jdk-path>/lib/tools.jarto the IDEA jdk classpath.
Note: If you run into issues compiling
*.groovy files, make sure you enable the Groovy plugin.
To build Android Studio, click the Run button (which looks like a green ‘play’ button) near the top right corner of the IDE.
To build Android Studio from the command line, run the bash shell as Administrator and execute the following commands:
$ cd studio-main/tools/idea $ ./build_studio.sh
Windows users: to build Android Studio from the command line from a Windows machine, run Command Prompt as Administrator and execute the following commands:
$ cd studio-main/tools/idea $ ant
You should find compressed build artifacts in
studio-main/out/artifacts/. To run the version of Android Studio you just built, extract the artifact for your OS, and then run either
\bin\studio.exe from the extracted directory.
Error: java: package com.sun.source.tree does not exist: Make sure to add
tools.jar to the “IDEA jdk” configuration, as explained above in Build Android Studio using IntelliJ.
java.lang.UnsatisfiedLinkError: C:\cygwin64\home...\tools\idea\bin\win\jumplistbridge64.dll: Access is denied: You may get this exception if you are trying to load and run the IDE project on Windows using Cygwin. To fix this issue, grant execute permissions to necessary files by opening a command prompt as Administrator and running the following command:
icacls C:\cygwin64\home\Android\aosp\tools\idea\bin\win\* /grant Everyone:(RX)
Alternatively, you can navigate to the
tools\bin\win\ directory and perform the following actions for each