Working with Android code requires using both Git (an open-source version-control system) and Repo (a Google-built repository-management tool that runs on top of Git). See the Source Control Workflow page for a summary of regular actions you can take, such as uploading changes for review.
Git handles large projects that are distributed over multiple repositories. Android uses Git for local operations such as local branching, commits, diffs, and edits. One of the challenges in setting up the Android project was determining how to best support the outside community—from the hobbyist community to the large OEMs building mass-market consumer devices. Google wanted components to be replaceable, and wanted interesting components to have a life of their own, outside of Android. Google first chose a distributed revision control system, then narrowed it down to Git.
For more details on Git, refer to this Git Documentation.
The Repo Launcher provides a Python script that initializes a checkout and
downloads the second part, the full Repo tool. The full Repo tool is included in
an Android source code checkout. It’s located, by default, in
$SRCDIR/.repo/repo/... and it receives forwarded commands from the
downloaded Repo Launcher.
Repo doesn’t replace Git, it only makes it easier to work with Git in the
context of Android. Repo uses manifest files
to aggregate Git projects into the Android superproject. You can put the
repo command, which is an executable Python script, anywhere
in your path. In working with the Android source files, you can use Repo for
across-network operations such as with a single Repo working directory.
In most situations, you can use Git instead of Repo, or mix Repo and Git commands to form complex commands. However, using Repo for basic across-network operations makes your work much simpler. For more details on Repo, see the Repo Command Reference, Repo README, the Preupload Hooks (tests) that can be enabled in Repo, and general docs in AOSP.
To download and install the Repo Launcher from git-repo- downloads, see Installing Repo.
Gerrit is a web-based code review system for projects that use Git. Gerrit encourages a more centralized use of Git by allowing all authorized users to submit changes, which are automatically merged if they pass code review. In addition, Gerrit makes reviewing easy, displaying changes side by side in the browser and enabling inline comments.
Android Code Search
Android Code Search allows you to search AOSP without downloading anything. You can use Code Search to view the AOSP source code, switch between open source branches, and navigate cross-references. For more information, see the Google Developers site for the Code Search documentation.
Android Studio is the official integrated development environment (IDE) for Android app development.
Android Debug Bridge (ADB) lets you connect your development workstation directly to your Android device so you can install packages and evaluate your changes.
For Android 10 and higher, use the IntelliJ with AIDEgen IDE for Android platform development.
Follow these steps to install Repo:
- Ensure that you have a
bin/directory in your home directory and that it's included in your path:
- Download the Repo Launcher and ensure that it's executable:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
- Optionally, verify the launcher matches the Google signatures:
gpg --recv-key 8BB9AD793E8E6153AF0F9A4416530D5E920F5C65
curl https://storage.googleapis.com/git-repo-downloads/repo.asc | gpg --verify - ~/bin/repo
Older repo for legacy Python 2 systems
To download an older version of the Repo Launcher, use these commands:
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x ~/bin/repo