A partir de 27 de março de 2025, recomendamos usar android-latest-release em vez de aosp-main para criar e contribuir com o AOSP. Para mais informações, consulte Mudanças no AOSP.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A origem do Android fica em uma coleção de repositórios Git hospedados pelo
Google. O repositório Git inclui todo o histórico do Android,
incluindo mudanças na origem e quando elas foram feitas. Esta página
descreve como fazer o download da origem.
Inicializar o cliente do Repo
Configure seu cliente para acessar o repositório de origem do Android:
Crie e acesse um diretório de trabalho:
mkdirWORKING_DIRECTORYcdWORKING_DIRECTORY
Inicializar seu diretório de trabalho para controle de origem:
A opção -b é usada para identificar a ramificação que você está inicializando. Se -b
não for fornecida, repo init será padronizada para a ramificação principal. Para uma lista de
ramificações e nomes de tags, consulte
Tags e builds do código-fonte.
A opção -u é necessária e é usada para especificar um arquivo de manifesto.
Esse é um arquivo XML que especifica onde os vários projetos Git
na origem do Android são posicionados no seu diretório de trabalho.
Neste exemplo, o nome do arquivo de manifesto não é especificado,
então o comando usa o arquivo de manifesto padrão (default.xml).
Execute o comando abaixo para baixar a árvore da origem do Android para seu diretório de
trabalho:
$reposync-c-j8
O argumento -c instrui o Repo a buscar a ramificação atual do manifesto do
servidor. O comando -j8 divide a sincronização entre as linhas de execução para que ela seja concluída mais
rapidamente.
O AOSP pode ser executado diretamente em emuladores Cuttlefish, mas não pode ser usado em hardware sem outras bibliotecas reservadas específicas do dispositivo. Você pode extrair os binários do dispositivos desta forma:
Se você estiver baixando a ramificação main e criando para um dispositivo Nexus ou Pixel,
faça o download dos binários mais recentes do
site de pré-lançamento de binários.
Se você estiver baixando e criando a ramificação main para seu
próprio dispositivo, é preciso fornecer os binários específicos do seu dispositivo.
Se você estiver baixando e criando uma ramificação com tags, que não seja a principal e que seja para um dispositivo Nexus ou Pixel, baixe o binário específico do dispositivo de
Binários para dispositivos Nexus e Pixel.
Extrair binários reservados
Cada conjunto de binários é fornecido como um script de autoextração em um arquivo
compactado. Para extrair e posicionar esses binários no local correto da sua
árvore de origem:
Extraia o arquivo.
Execute o script de shell de autoextração que está na raiz da sua
árvore de origem do AOSP.
Concorde com os termos do contrato de licença anexo. Os binários e os makefiles
correspondentes serão instalados na hierarquia vendor/ da árvore de origem.
(Opcional) Verificar a legitimidade do código
Se houver preocupação quanto à legitimidade do código-fonte (por exemplo, se
veio do Google ou não), você pode verificar as tags do Git da ramificação. Para verificar as tags do Git:
Copie e cole o bloco de chave a seguir em um arquivo de texto, como
keyfile.asc.
-----BEGIN PGP PUBLIC KEY BLOCK-----Version:GnuPG v1.4.2.2 (GNU/Linux)mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSVlFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw78tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMDu4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0ZwNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJvaWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5kcm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAlQN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806UphisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbkC2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMXLWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/MpK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7sKZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phbN8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjAvUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwoG1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQhN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0lEXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM==Wi5D-----END PGP PUBLIC KEY BLOCK-----
Execute o comando abaixo para inserir uma chave pública em um banco de dados de chave
GnuPG. A chave é usada para assinar tags anotadas que representam versões.
$gpg--importkeyfile.asc
Depois de importar as chaves, você pode verificar qualquer tag executando este comando:
$gittag-vTAG_NAME
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2025-03-26 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-03-26 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+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PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M\n pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s\n KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb\n N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA\n vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo\n G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ\n hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l\n EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+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"]]