از 27 مارس 2025، توصیه می کنیم از android-latest-release به جای aosp-main برای ساختن و کمک به AOSP استفاده کنید. برای اطلاعات بیشتر، به تغییرات AOSP مراجعه کنید.
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این صفحه جزئیاتی را برای فلش کردن بیلدهای اندروید روی دستگاه ها با استفاده از ابزارهای fastboot و adb ارائه می دهد. Adb به شما این امکان را می دهد که ایستگاه کاری توسعه خود را مستقیماً به دستگاه مجهز به اندروید خود متصل کرده و عملیات های مختلفی را انجام دهید. Fastboot به شما امکان می دهد اندروید (فلش) را نصب کنید و با بوت لودر دستگاه تعامل داشته باشید تا بتوانید تغییرات سیستم عامل و برنامه خود را آزمایش کنید. برای اطلاعات بیشتر در مورد نحوه کار adb، با تاکید بر توسعه برنامه، به صفحه Android Studio's Android Debug Bridge (adb) مراجعه کنید. اگر جزئیات کد adb را می خواهید، adb README را ببینید.
بررسی کنید که fastboot و adb دارید
وقتی اندروید میسازید، adb و fastboot بهطور پیشفرض ساخته میشوند. برای تایید در دسترس بودن adb و fastboot، دستورات زیر را اجرا کنید:
adb--versionfastboot--version
اگر شماره نسخه ها را می بینید، fastboot و adb را نصب کرده اید. اگر شمارههای نسخه را نمیبینید، مطمئن شوید که Android را ساختهاید . با موفقیت به فعال کردن اتصال USB خود ادامه دهید.
اتصال USB خود را فعال کنید
قبل از اجرای Android روی دستگاه، باید اتصال USB خود را فعال کنید:
باز کردن قفل OEM و اشکال زدایی USB را در گزینه های توسعه دهنده فعال کنید:
در برنامه تنظیمات، روی درباره تلفن ضربه بزنید.
هفت بار روی Build number ضربه بزنید.
وقتی پیام You are now a developer را می بینید! ، روی <- ضربه بزنید.
روی System و سپس Developer options ضربه بزنید.
باز کردن قفل OEM و اشکال زدایی USB را فعال کنید. اگر باز کردن قفل OEM در دسترس نیست، به اینترنت وصل شوید تا دستگاه بتواند بررسی کند. اگر باز هم کار نکرد، میتوانید اجباری را بررسی کنید: در برنامه Dialer، *#*#CHECKIN#*#* (*#*#2432546#*#*) را وارد کنید (بدون نیاز به سیمکارت). پس از وارد کردن شماره (بدون نیاز به فشار دادن تماس)، متن ناپدید می شود و یک اعلان موفقیت ظاهر می شود.
اگر باز کردن قفل OEM در دسترس نباشد، ممکن است سیم کارت دستگاه شما توسط شرکت مخابراتی قفل شده باشد و بوت لودر قابل باز شدن نباشد.
دستگاه خود را به یک پورت USB در ایستگاه کاری خود وصل کنید.
به حالت Fastboot بوت شوید
قبل از اینکه اندروید به دستگاهی فلش شود، دستگاه باید در حالت Fastboot باشد. دو راه برای بوت کردن دستگاه در حالت Fastboot وجود دارد:
از دستور adb استفاده کنید: از خط فرمان adb reboot bootloader تایپ کنید.
از ترکیب کلید استفاده کنید:
ترکیب کلید را برای دستگاه خود تعیین کنید. برای جدولی از ترکیب کلیدهای Fastboot، به ترکیب کلیدهای Fastboot مراجعه کنید.
دستگاه را خاموش کنید.
دستگاه را روشن کنید و بلافاصله کلید ترکیبی دستگاه خود را نگه دارید (که در مرحله 1 تعیین شده است).
بوت لودر را باز کنید
پس از بوت شدن در حالت فست بوت، باید بوت لودر را باز کنید.
برای باز کردن قفل بوت لودر:
(اختیاری) از هر فایل مهم موجود در دستگاه نسخه پشتیبان تهیه کنید.
دستور باز کردن قفل را برای دستگاه خود اجرا کنید:
اگر در حال بهروزرسانی یک دستگاه Nexus یا Pixel هستید که در سال 2015 یا بعد از آن تولید شده است، fastboot flashing unlock اجرا کنید.
برای Pixel 2: برای فلش کردن بوت لودر، بررسی کنید که بوت لودر Pixel 2 حداقل به نسخه Oreo MR1 به روز شده باشد. برای بهروزرسانی به Pixel 2 به این نسخه، بهروزرسانی بدون هوا (OTA) را اعمال کنید یا یک OTA کامل را در کنار بارگذاری کنید.
فقط برای Pixel 2 XL با نسخه لودر قبل از TMZ20a: ممکن است لازم باشد قفل پارتیشنهای مهم قبل از چشمک زدن باز شوند. برای باز کردن قفل پارتیشنهای مهم فقط در Pixel 2 XL، fastboot flashing unlock_critical اجرا کنید.
اگر در حال باز کردن قفل دستگاهی قبل از 2015 هستید، fastboot oem unlock اجرا کنید.
دستگاه مورد نظر یک صفحه تایید نمایش می دهد.
تأیید کنید که میخواهید تمام اطلاعات کاربر را پاک کنید و قفل دستگاه را باز کنید.
فلش کردن یک دستگاه
شما می توانید کل سیستم اندروید را با یک دستور فلش کنید. فلش کردن کل سیستم با یک فرمان تأیید می کند که سیستم فلش شده با بوت لودر و رادیو نصب شده سازگار است، بوت، بازیابی و پارتیشن های سیستم را با هم می نویسد و سیستم را راه اندازی مجدد می کند.
برای فلش کردن دستگاه:
با نگه داشتن کلید ترکیبی مناسب در هنگام بوت یا با استفاده از دستور زیر، دستگاه را در حالت فست بوت قرار دهید:
adbrebootbootloader
پس از اینکه دستگاه در حالت فست بوت قرار گرفت، اجرا کنید:
fastbootflashall-w
گزینه -w پارتیشن /data را روی دستگاه پاک می کند، که برای اولین بار فلش کردن یک دستگاه خاص مفید است.
قفل مجدد بوت لودر
برای قفل مجدد بوت لودر:
برای دستگاه های 2015 یا جدیدتر، دستور fastboot flashing lock اجرا کنید
برای دستگاه های 2014 یا قبل از آن، دستور fastboot oem lock اجرا کنید
دستگاه را به حالت کارخانه بازگردانید
تصاویر کارخانه برای دستگاههای Google از Factory Images برای Nexus و Pixel Devices در دسترس هستند. تصاویر کارخانه موتورولا Xoom مستقیماً توسط موتورولا توزیع می شود.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و 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,["# Flash with Fastboot\n\nThis page provides details for flashing Android builds onto devices using the\n*fastboot* and *adb* tools. Adb lets you connect your\ndevelopment workstation directly to your Android-powered device and\nperform a variety of operations. Fastboot lets you install (flash) Android\nand interact with the device's bootloader so you can test your OS and app\nchanges. For additional information on how adb works, with emphasis on app\ndevelopment, see\n[Android Studio's Android Debug Bridge (adb) page](https://developer.android.com/studio/command-line/adb).\nIf you want details on the code for adb, see the adb\n[README](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/adb/README.md).\n| **Note:** Google provides an additional flash tool, called [*Android Flash Tool*](/docs/setup/test/flash), that is intended for use only with prebuilt builds.\n| **Note:** Fastboot is also the name of a bootloader module and mode.\n\nVerify that you have fastboot and adb\n-------------------------------------\n\nWhen you build Android, adb and fastboot is built by default. To confirm\nthe availability of adb and fastboot, run the following commands: \n\n adb --version\n fastboot --version\n\nIf you see version numbers, you have fastboot and adb installed. If you\ndon't see version numbers, ensure you\n[built Android](/docs/setup/build/building).\nsuccessfully. Continue to\n[Enable your USB connection](#enable-usb).\n\nEnable your USB connection\n--------------------------\n\nBefore running Android on a device, you must enable your USB connection:\n\n1. Enable OEM unlocking and USB debugging in the developer options:\n\n 1. In the Settings app, tap **About phone**.\n 2. Tap **Build number** seven times.\n 3. When you see the message **You are now a developer!** , tap **\\\u003c-**.\n 4. Tap **System** , then tap **Developer options**.\n 5. Enable **OEM unlocking** and **USB debugging** . If OEM unlocking is unavailable, connect to the internet so the device can check in. If that still doesn't work, you can force a check in: In the Dialer app, enter **\\*#\\*#CHECKIN#\\*#\\*** (\\*#\\*#2432546#\\*#\\*) (no SIM required). After entering the number (no need to press call), the text disappears and a success notification appears.\n\n If OEM unlocking remains unavailable, your device might be SIM locked by\n your carrier and the bootloader can't be unlocked.\n2. Connect your device to a USB port on your workstation.\n\nBoot into Fastboot mode\n-----------------------\n\nBefore Android can be flashed to a device, a device must be in Fastboot mode.\nThere are two ways to boot a device into Fastboot mode:\n\n- Use the `adb` command: From the command-line, type `adb reboot bootloader`.\n- Use a key combination:\n 1. Determine the key combination for your device. For a table of Fastboot key combinations, see [Fastboot key combinations](/docs/setup/reference/fastboot-keys).\n 2. Turn the device off.\n 3. Turn the device on and immediately hold down the key combination for your device (determined in step 1).\n\nUnlock the bootloader\n---------------------\n\nAfter booting into fastboot mode, you must unlock the bootloader.\n| **Warning:** For privacy reasons, unlocking the bootloader deletes user data. After unlocking, all data on the device is erased, including both private app data and shared data accessible over USB (including photos and movies).\n\nTo unlock the bootloader:\n\n1. (Optional) Back up any important files on the device.\n2. Run the unlock command for your device:\n\n - If you're updating a Nexus or Pixel device that is manufactured in 2015 or later, run `fastboot flashing unlock`.\n - For Pixel 2: To flash the bootloader, verify that the Pixel 2's bootloader is updated to at least Oreo MR1's version. To update to a Pixel 2 to this version, apply the over-the-air (OTA) update or sideload a [full OTA](https://developers.google.com/android/ota).\n - For Pixel 2 XL only with loader version prior to TMZ20a: The critical partitions might need to be unlocked before flashing. To unlock the critical partitions on Pixel 2 XL only, run `fastboot flashing unlock_critical`.\n - If you're unlocking a pre-2015 device, run `fastboot oem unlock`.\n\n The target device displays a confirmation screen.\n3. Confirm that you want to erase all user data and unlock the device.\n\n | **Tip:** If your device is shown in the output before reboot, but Fastboot or the flash script are misbehaving, it might be an issue with your USB cable. Try a different port or switching connectors. For example, if you're using a USB C port on your workstation try a USB A port instead.\n\n| **Note:** On Nexus 10, after unlocking the bootloader, the internal storage remains unformatted. You can format the device using `fastboot format cache` followed by `fastboot format userdata`.\n\nFlash a device\n--------------\n\nYou can flash an entire Android system in a single command. Flashing an entire\nsystem with a single command verifies that the system being flashed is\ncompatible with the installed bootloader and radio, writes the boot, recovery,\nand system partitions together, and reboots the system.\n\nTo flash a device:\n\n1. Place the device in fastboot mode by holding the appropriate\n key combination at boot or using the following command:\n\n adb reboot bootloader\n\n2. After the device is in fastboot mode, run:\n\n fastboot flashall -w\n\nThe `-w` option wipes the `/data` partition on the device, which is useful\nfor your first time flashing a particular device.\n| **Note:** File systems created with `fastboot` on Motorola Xoom don't function optimally. Google recommends that you recreate file systems through recovery using `adb reboot recovery`. While in recovery, open the menu (press **Power + Volume Up**), wipe the cache partition, then wipe the data.\n\n### Re-locking the bootloader\n\nTo re-lock the bootloader:\n\n- For 2015 or later devices, run the command `fastboot flashing lock`\n- For 2014 or earlier devices, run the command `fastboot oem lock`\n\nRestore device to factory state\n-------------------------------\n\nFactory images for Google devices are available from\n[Factory Images for Nexus and Pixel Devices](https://developers.google.com/android/nexus/images).\nFactory images for the Motorola Xoom are distributed directly by Motorola."]]