Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release, bukan aosp-main, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Menyiapkan pengembangan AOSP (9.0 atau yang lebih baru)
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Sebelum mendownload dan mem-build cabang rilis terbaru Android
(android16-release) dari sumber Android, pastikan
hardware Anda memenuhi persyaratan yang diperlukan dan software yang diperlukan
diinstal dengan benar. Anda juga harus memahami istilah-istilah berikut:
Git
Git adalah sistem kontrol versi terdistribusi open source dan gratis.
Android menggunakan Git untuk operasi lokal seperti cabang, commit, perbedaan,
dan pengeditan. Untuk mendapatkan bantuan dalam mempelajari Git, lihat dokumentasi Git.
Repo
Repo adalah wrapper Python di sekitar Git yang menyederhanakan
operasi kompleks di beberapa repositori Git. Repo tidak menggantikan Git
untuk semua operasi kontrol versi, tetapi hanya mempermudah
pencapaian operasi Git yang kompleks. Repo menggunakan file manifes untuk menggabungkan project Git ke dalam
superproject Android.
File manifes
File manifes adalah file XML yang menentukan tempat berbagai project Git dalam
sumber Android ditempatkan dalam hierarki sumber AOSP.
Persyaratan Meet hardware
Workstation pengembangan Anda harus memenuhi atau melebihi persyaratan
hardware berikut:
Sistem x86 64-bit.
Minimal 400 GB ruang disk kosong untuk check out dan mem-build kode
(250 GB untuk check out + 150 GB untuk mem-build).
RAM minimum 64 GB. Google menggunakan mesin 72 core dengan RAM
64 GB untuk mem-build Android. Dengan konfigurasi hardware ini, perlu waktu
sekitar 40 menit untuk build Android lengkap dan hanya beberapa menit untuk build Android inkremental. Sebaliknya, perlu waktu sekitar 6 jam untuk
build lengkap dengan mesin 6 core dengan RAM 64 GB.
Memenuhi persyaratan sistem operasi
Workstation pengembangan Anda harus menjalankan distribusi Linux 64-bit apa pun dengan GNU C
Library (glibc) 2.17 atau yang lebih baru.
Menginstal paket yang diperlukan
Untuk mem-build Android 11 atau yang lebih tinggi, Anda harus menggunakan Ubuntu 18.04 atau yang lebih baru. Untuk menginstal
paket yang diperlukan untuk Ubuntu 18.04 atau yang lebih baru, jalankan perintah berikut:
Di antara paket yang diinstal, perintah ini menginstal Git, yang digunakan untuk
mendownload sumber AOSP.
Menginstal software yang diperlukan
Sebelum dapat menggunakan AOSP, Anda harus menginstal OpenJDK, Make,
Python 3, dan Repo. Cabang rilis terbaru Android dilengkapi dengan versi
OpenJDK, Make, dan Python 3 bawaan, sehingga langkah penginstalan tambahan tidak
diperlukan. Bagian berikut menjelaskan cara menginstal Repo.
Menginstal Repo
Ikuti langkah-langkah berikut untuk menginstal Repo:
Download informasi paket saat ini:
sudoapt-getupdate
Jalankan perintah berikut untuk menginstal peluncur Repo:
sudoapt-getinstallrepo
Peluncur Repo menyediakan skrip Python yang menginisialisasi checkout
dan mendownload alat Repo lengkap.
Jika berhasil, lanjutkan ke langkah 4.
(opsional) Instal Repo secara manual menggunakan serangkaian perintah berikut:
Tiga perintah pertama menyiapkan file sementara, mendownload Repo ke file, dan
memverifikasi bahwa kunci yang diberikan cocok dengan kunci yang diperlukan. Jika perintah ini
berhasil, perintah terakhir akan menginstal peluncur Repo.
Verifikasi versi peluncur Repo:
repoversion
Output akan menunjukkan versi 2.4 atau yang lebih tinggi, misalnya:
repo launcher version 2.45
Menetapkan direktori output alternatif
Secara default, output setiap build disimpan di subdirektori out/
hierarki sumber yang cocok. Anda dapat mengganti direktori ini dengan mengekspor
variabel lingkungan OUT_DIR. Misalnya, jika ingin menyimpan output
di drive lain, Anda dapat mengarahkan OUT_DIR ke drive tersebut:
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 UTC."],[],[],null,["# Set up for AOSP development (9.0 or later)\n\nBefore you download and build the Android latest release branch\n(android16-release) of the Android source, ensure\nthat your hardware meets the necessary requirements and that required software\nis properly installed. You should also be familiar with the following terms:\n\n*Git*\n: Git is a free and open source distributed version control system.\n Android uses Git for local operations such as branching, commits, diffs,\n and edits. For help learning Git, refer to the [Git documentation](https://git-scm.com/doc).\n\n*Repo*\n: Repo is a Python wrapper around Git that simplifies performing\n complex operations across multiple Git repositories. Repo doesn't replace Git\n for all version control operations, it only makes complex Git operations easier\n to accomplish. Repo uses manifest files to aggregate Git projects into the\n Android superproject.\n\n*Manifest file*\n: A manifest file is an XML file specifying where the various Git projects in\n the Android source are placed within an AOSP source tree.\n| **Note:** All commands in this documentation are preceded by a dollar sign ($) to differentiate them from output or entries within files. To copy a command to the clipboard, click the **Copy code sample** icon in the top right of each command box.\n| **Note:** If you want to build Android 2.3 - 8.0, refer to [Set up for AOSP development (2.3 - 8.0)](/docs/setup/start/older-versions).\n\nMeet hardware requirements\n--------------------------\n\nYour development workstation should meet or exceed these hardware\nrequirements:\n\n- A 64-bit x86 system.\n\n | **Note:** You can compile AOSP versions previous to 2.3.x on 32-bit systems.\n- At least 400 GB of free disk space to check out and build the code\n (250 GB to check out + 150 GB to build).\n\n | **Note:** If you're checking out a mirror, you need more space because the full Android Open Source Project (AOSP) mirrors contain all Git repositories that have ever been used.\n- A minimum of 64 GB of RAM. Google uses 72-core machines with 64 GB\n of RAM to build Android. With this hardware configuration, it takes\n approximately 40 minutes for a full build of Android and only a few minutes for incremental build of Android. By contrast, it takes approximately 6 hours for a\n full build with a 6-core machine with 64 GB of RAM.\n\nMeet operating system requirements\n----------------------------------\n\nYour development workstation must run any 64-bit Linux distribution with GNU C\nLibrary (glibc) 2.17 or later.\n| **Warning:** Android OS development on macOS isn't supported as of June 22, 2021 (Android 11). For information on configuring your development workstation for macOS, refer to [Set Up for AOSP development (2.3 - 8.0)](/docs/setup/start/older-versions).\n\nInstall required packages\n-------------------------\n\nTo build Android 11 or higher, you must use Ubuntu 18.04 or later. To install\nrequired packages for Ubuntu 18.04 or later, run the following command: \n\n sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig\n\nAmong the packages installed, this command installs Git, which is used to\ndownload the AOSP source.\n| **Note:** This command works for Ubuntu 18.04 or later. For package installation for earlier versions of Ubuntu, see [Setup for Android development (AOSP 2.3 - 8)](/docs/setup/start/older-versions).\n\nInstall required software\n-------------------------\n\nBefore you can work with AOSP, you must have installations of OpenJDK, Make,\nPython 3, and Repo. The latest release branch of Android comes with prebuilt\nversions of OpenJDK, Make, and Python 3, so additional installation steps aren't\nrequired. The following section explains how to install Repo.\n\n### Install Repo\n\nFollow these steps to install Repo:\n\n1. Download the current package information:\n\n sudo apt-get update\n\n2. Run the following command to install the Repo launcher:\n\n sudo apt-get install repo\n\n The Repo launcher provides a Python script that initializes a checkout\n and downloads the full Repo tool.\n\n If successful, skip to step 4.\n3. (optional) Manually install Repo using the following series of commands:\n\n export REPO=$(mktemp /tmp/repo.XXXXXXXXX)\n curl -o ${REPO} https://storage.googleapis.com/git-repo-downloads/repo\n gpg --recv-keys 8BB9AD793E8E6153AF0F9A4416530D5E920F5C65\n curl -s https://storage.googleapis.com/git-repo-downloads/repo.asc | gpg --verify - ${REPO} && install -m 755 ${REPO} ~/bin/repo\n\n The first three commands set up a temp file, download Repo to the file, and\n verify that the key provided matches the required key. If these commands are\n successful, the final command installs the Repo launcher.\n4. Verify the Repo launcher version:\n\n repo version\n\n The output should indicate a version of 2.4 or higher, for example:\n\n `repo launcher version 2.45`\n\nSet an alternative output directory\n-----------------------------------\n\nBy default, the output of each build is stored in the `out/` subdirectory of\nthe matching source tree. You can override this directory by exporting the\n`OUT_DIR` environment variable. For example, if you want to store your output\non a different drive, you can point `OUT_DIR` to that drive: \n\n export OUT_DIR=\u003cvar translate=\"no\"\u003emy_other_drive\u003c/var\u003e\n\nWhat's next?\n------------\n\n- To download the source code, continue to [Download the Android source](/docs/setup/download).\n- For help learning Git, see the [Git documentation](https://git-scm.com/doc).\n- For additional Repo documentation, see the [Repo README](https://gerrit.googlesource.com/git-repo/+/refs/heads/main/README.md).\n- For a list of all Repo commands, refer to the [Repo command reference](/docs/setup/reference/repo)."]]