از 27 مارس 2025، توصیه می کنیم از android-latest-release به جای aosp-main برای ساختن و کمک به AOSP استفاده کنید. برای اطلاعات بیشتر، به تغییرات AOSP مراجعه کنید.
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
قبل از دانلود و ساخت آخرین شاخه اندروید (android16-release) از منبع اندروید، مطمئن شوید که سخت افزار شما الزامات لازم را برآورده می کند و نرم افزار مورد نیاز به درستی نصب شده است. همچنین باید با اصطلاحات زیر آشنا باشید:
Git
Git یک سیستم کنترل نسخه توزیع شده رایگان و متن باز است. اندروید از Git برای عملیات محلی مانند شاخهبندی، commits، diffs و ویرایشها استفاده میکند. برای کمک به یادگیری Git، به مستندات Git مراجعه کنید.
مخزن
Repo یک پوشش پایتون در اطراف Git است که انجام عملیات پیچیده را در چندین مخزن Git ساده می کند. Repo جایگزین Git برای همه عملیات کنترل نسخه نمی شود، فقط انجام عملیات پیچیده Git را آسان تر می کند. Repo از فایل های مانیفست برای جمع آوری پروژه های Git در ابرپروژه اندروید استفاده می کند.
فایل مانیفست
فایل مانیفست یک فایل XML است که مشخص میکند پروژههای مختلف Git در منبع Android کجا در درخت منبع AOSP قرار میگیرند.
نیازهای سخت افزاری را برآورده کنید
ایستگاه کاری توسعه شما باید این الزامات سخت افزاری را برآورده کند یا از آن فراتر رود:
یک سیستم 64 بیتی x86.
حداقل 400 گیگابایت فضای دیسک رایگان برای بررسی و ساخت کد (250 گیگابایت برای بررسی + 150 گیگابایت برای ساخت).
حداقل 64 گیگابایت رم. گوگل از ماشین های ۷۲ هسته ای با ۶۴ گیگابایت رم برای ساخت اندروید استفاده می کند. با این پیکربندی سخت افزاری، تقریباً 40 دقیقه برای ساخت کامل اندروید و تنها چند دقیقه برای ساخت تدریجی اندروید طول می کشد. در مقابل، برای ساخت کامل با یک دستگاه 6 هسته ای با 64 گیگابایت رم تقریباً 6 ساعت طول می کشد.
نیازهای سیستم عامل را برآورده کنید
ایستگاه کاری توسعه شما باید هر توزیع لینوکس 64 بیتی را با کتابخانه GNU C (glibc) 2.17 یا بالاتر اجرا کند.
بسته های مورد نیاز را نصب کنید
برای ساخت اندروید 11 یا بالاتر، باید از اوبونتو 18.04 یا بالاتر استفاده کنید. برای نصب بسته های مورد نیاز برای اوبونتو 18.04 یا جدیدتر، دستور زیر را اجرا کنید:
در بین بسته های نصب شده، این دستور Git را نصب می کند که برای دانلود سورس AOSP استفاده می شود.
نرم افزار مورد نیاز را نصب کنید
قبل از اینکه بتوانید با AOSP کار کنید، باید OpenJDK، Make، Python 3 و Repo را نصب کنید. آخرین شاخه منتشر شده اندروید با نسخه های از پیش ساخته شده OpenJDK، Make و Python 3 عرضه می شود، بنابراین نیازی به مراحل نصب اضافی نیست. قسمت زیر نحوه نصب Repo را توضیح می دهد.
Repo را نصب کنید
برای نصب Repo مراحل زیر را دنبال کنید:
اطلاعات بسته فعلی را دانلود کنید:
sudoapt-getupdate
برای نصب لانچر Repo دستور زیر را اجرا کنید:
sudoapt-getinstallrepo
راهانداز Repo یک اسکریپت پایتون را ارائه میکند که یک پرداخت را اولیه میکند و ابزار کامل Repo را دانلود میکند.
در صورت موفقیت، به مرحله 4 بروید.
(اختیاری) با استفاده از سری دستورات زیر Repo را به صورت دستی نصب کنید:
سه دستور اول یک فایل موقت را تنظیم می کنند، Repo را در فایل دانلود می کنند و بررسی می کنند که کلید ارائه شده با کلید مورد نیاز مطابقت دارد. در صورت موفقیت آمیز بودن این دستورات، دستور نهایی لانچر Repo را نصب می کند.
نسخه لانچر Repo را تأیید کنید:
repoversion
خروجی باید نسخه 2.4 یا بالاتر را نشان دهد، به عنوان مثال:
repo launcher version 2.45
یک فهرست خروجی جایگزین تنظیم کنید
بهطور پیشفرض، خروجی هر بیلد در فهرست out/ درخت منبع منطبق ذخیره میشود. با صادر کردن متغیر محیطی OUT_DIR می توانید این دایرکتوری را لغو کنید. به عنوان مثال، اگر می خواهید خروجی خود را در درایو دیگری ذخیره کنید، می توانید OUT_DIR به آن درایو نشان دهید:
برای فهرستی از تمام دستورات Repo، به مرجع دستور Repo مراجعه کنید.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی."],[],[],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)."]]