Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
The Android source is located in a collection of Git repositories hosted by
Google. The Git repository includes the entire history of the Android source,
including changes to the source and when the changes were made. This page
describes how to download the source.
Initialize the Repo client
Set up your client to access the Android source repository:
Create and navigate to a working directory:
mkdirWORKING_DIRECTORYcdWORKING_DIRECTORY
Initialize your working directory for source control:
The -b option is used to identify the branch you're initializing. For a
list of branches and tag names, see
Source code tags and builds.
Use tag names or branch names with the -b option.
The -u option is required and is used to specify a manifest file,
which is an XML file specifying where the various Git projects
in the Android source are placed within your working directory.
In this example, the name of the manifest file isn't specified,
so the command uses the default manifest file (default.xml).
Run the following command to download the Android source tree to your working
directory:
reposync-c-j8
The -c argument instructs Repo to fetch the current manifest branch from
the server. The -j8 command splits the sync across threads for faster
completion.
AOSP can run on Cuttlefish emulators directly, but AOSP can't be used on hardware without additional device-specific proprietary libraries. Here's how to obtain those device binaries:
If you're downloading the main branch and building for a Nexus or Pixel
device, download the latest binaries from the
Binaries preview site.
If you're downloading and building the main branch and building for your
own device, you must provide your device-specific binaries.
If you're downloading and building a tagged, non-main, branch and building
for a Nexus or Pixel device, download the device-specific binary from
Driver Binaries for Nexus and Pixel devices.
Extract proprietary binaries
Each set of binaries comes as a self-extracting script in a compressed
archive. To extract and place these binaries in the correct location of your
source tree:
Extract the archive.
Run the included self-extracting shell script from the root of your AOSP
source tree.
Agree to the terms of the enclosed license agreement. The binaries and their
matching makefiles are installed in the vendor/ hierarchy of the source tree.
(optional) Verify code legitimacy
If you're concerned about the legitimacy of the source code, such as whether it
came from Google, you can verify the Git tags for the branch.
To verify Git tags:
Copy and paste the following key block into a text file, such as
keyfile.asc.
-----BEGIN PGP PUBLIC KEY BLOCK-----Version:GnuPG v1.4.2.2 (GNU/Linux)mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSVlFhpHaws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MpK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7sKZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phbN8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjAvUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwoG1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQhN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0lEXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM==Wi5D-----END PGP PUBLIC KEY BLOCK-----
Run the following command to input a public key into your GnuPG key
database. The key is used to sign annotated tags that represent releases.
gpg--importkeyfile.asc
After importing the keys, you can verify any tag by running this command:
gittag-vTAG_NAME
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-08 UTC."],[],[],null,["# Download the Android source\n\nThe Android source is located in a collection of Git repositories hosted by\nGoogle. The Git repository includes the entire history of the Android source,\nincluding changes to the source and when the changes were made. This page\ndescribes how to download the source.\n| **Note:** All commands on this page are preceded by a dollar sign ($) to differentiate them from output or entries within files. To omit the dollar sign when copying the command, click the **Copy code sample** icon in the top right of each command box.\n| **Note:** To obtain the source code for third-party components where the open source license grants you the right to receive the source, see [Obtain Android source](/docs/setup/download/opensourcerequest).\n\nInitialize the Repo client\n--------------------------\n\nSet up your client to access the Android source repository:\n\n1. Create and navigate to a working directory:\n\n mkdir \u003cvar translate=\"no\"\u003eWORKING_DIRECTORY\u003c/var\u003e\n cd \u003cvar translate=\"no\"\u003eWORKING_DIRECTORY\u003c/var\u003e\n\n | **Note:** You can have more than one version of Android on your development machine as long as they exist in separate directories. Each checkout and build uses at least 300 GB of space.\n2. Initialize your working directory for source control:\n\n repo init --partial-clone --no-use-superproject -b android-latest-release -u https://android.googlesource.com/platform/manifest\n\n The `-b` option is used to identify the branch you're initializing. For a\n list of branches and tag names, see\n [Source code tags and builds](/docs/setup/reference/build-numbers#source-code-tags-and-builds).\n Use tag names or branch names with the `-b` option.\n | **Note:** These instructions assume you're working in the `android-latest-release` branch. If you want to make changes in a different branch, you must initialize your Repo client and download source for that branch.\n\n The `-u` option is required and is used to specify a *manifest* file,\n which is an XML file specifying where the various Git projects\n in the Android source are placed within your working directory.\n In this example, the name of the manifest file isn't specified,\n so the command uses the default manifest file (`default.xml`).\n\n The output should contain the message: \n\n repo has been initialized in \u003cvar translate=\"no\"\u003epath_to_working_directory\u003c/var\u003e\n\nFor information on manifest file format, see\n[repo Manifest Format](https://gerrit.googlesource.com/git-repo/+/main/docs/manifest-format.md).\n\nFor a list of all Repo commands, see the\n[Repo command reference](/docs/setup/reference/repo).\n\nDownload the Android source\n---------------------------\n\nRun the following command to download the Android source tree to your working\ndirectory: \n\n repo sync -c -j8\n\nThe `-c` argument instructs Repo to fetch the current manifest branch from\nthe server. The `-j8` command splits the sync across threads for faster\ncompletion.\n\nThis operation should take a little over an hour.\n\nIf you run into any problems during download, refer to\n[Troubleshoot and fix sync issues](/docs/setup/download/troubleshoot-sync).\n\nDownload proprietary binaries\n-----------------------------\n\nAOSP can run on Cuttlefish emulators directly, but AOSP can't be used on hardware without additional device-specific proprietary libraries. Here's how to obtain those device binaries:\n\n- If you're downloading the `main` branch and building for a Nexus or Pixel device, download the latest binaries from the [Binaries preview site](https://developers.google.com/android/blobs-preview).\n- If you're downloading and building the `main` branch and building for your own device, you must provide your device-specific binaries.\n- If you're downloading and building a tagged, non-main, branch and building for a Nexus or Pixel device, download the device-specific binary from [Driver Binaries for Nexus and Pixel devices](https://developers.google.com/android/drivers).\n\n### Extract proprietary binaries\n\nEach set of binaries comes as a self-extracting script in a compressed\narchive. To extract and place these binaries in the correct location of your\nsource tree:\n\n1. Extract the archive.\n2. Run the included self-extracting shell script from the root of your AOSP source tree.\n3. Agree to the terms of the enclosed license agreement. The binaries and their matching makefiles are installed in the `vendor/` hierarchy of the source tree.\n\n(optional) Verify code legitimacy\n---------------------------------\n\nIf you're concerned about the legitimacy of the source code, such as whether it\ncame from Google, you can verify the Git tags for the branch.\n\nTo verify Git tags:\n\n1. Copy and paste the following key block into a text file, such as\n `keyfile.asc`.\n\n -----BEGIN PGP PUBLIC KEY BLOCK-----\n Version: GnuPG v1.4.2.2 (GNU/Linux)\n\n mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV\n lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7\n 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD\n u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z\n wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq\n /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5\n jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4\n MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9\n b/aF/ygcR8mh5h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oa+jv2QSTlrx4KLM=\n =Wi5D\n -----END PGP PUBLIC KEY BLOCK-----\n\n2. Run the following command to input a public key into your GnuPG key\n database. The key is used to sign annotated tags that represent releases.\n\n gpg --import keyfile.asc\n\n3. After importing the keys, you can verify any tag by running this command:\n\n git tag -v \u003cvar translate=\"no\"\u003eTAG_NAME\u003c/var\u003e"]]