自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
將 Pixel 裝置做為開發平台
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本指南主要適用於想使用 AAOS 進行測試和開發的開發人員
注意事項
使用 Pixel 做為開發平台時,適用下列限制:
必要條件
繼續操作之前,請確認您具備下列項目:
- 必須執行原始設備製造商 (OEM) 解鎖。
- 可建構 Android 程式碼的 Linux 電腦。詳情請參閱「建立建構環境」。
程式碼同步處理和建構
- 如要同步處理 Android 版本 AP1A.240405.002:
mkdir aaos_on_pixel
cd aaos_on_pixel
REPO_ALLOW_SHALLOW=0 repo init -c -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r30 --use-superproject --partial-clone --partial-clone-exclude=platform/frameworks/base --clone-filter=blob:limit=10M
repo sync -j32
- 請前往 developers.google.com 下載 Pixel 裝置的供應商映像檔,版本為 AP1A.240405.002
curl --output - https://dl.google.com/dl/android/aosp/google_devices-tangorpro-ap1a.240405.002-8d141153.tgz | tar -xzvf -
tail -n +315 extract-google_devices-tangorpro.sh | tar -zxvf -
- 取得修補程式
cd packages/services/Car
git fetch https://android.googlesource.com/platform/packages/services/Car refs/changes/83/3037383/2 && git cherry-pick FETCH_HEAD #fix the audio crash
cd -
- 執行建構作業。:
. build/envsetup.sh
lunch aosp_tangorpro_car-ap1a-userdebug
m
- 建構 Automotive 相關套件:
m android.hardware.automotive.vehicle@2.0-default-service android.hardware.automotive.audiocontrol-service.example
設定裝置以刷新版本
如果您尚未啟用「開發人員選項」,請先完成這項作業。依序前往「設定」>「系統」>「關於手機」,然後輕觸「版本號碼」七次。
啟用開發人員選項後:
- 依序前往「設定」>「系統」>「開發人員選項」,然後啟用「USB 偵錯」和「OEM 解鎖」:
刷新版本
- 如要將裝置切換至 Fastboot 模式並解鎖:
adb reboot bootloader
fastboot flashing unlock
- 在裝置上選取「解鎖系統啟動載入程式」。這樣做會清除裝置上的所有資料!
- 如何刷新版本:
fastboot -w flashall
- 在版本開始以動畫啟動後:
- 如要啟用
adb remount
:#Temporary disable the userdata checkpoint
adb wait-for-device root; sleep 3; adb shell vdc checkpoint commitChanges; sleep 2
#Enable remount
adb remount && sleep 2 && adb reboot && echo "rebooting the device" && adb wait-for-device root && sleep 5 && adb remount
- 如要將必要的 Automotive 專屬檔案推送至裝置,請按照下列步驟操作:
adb sync vendor && adb reboot
- 等待裝置啟動:

訣竅
- 如果螢幕亮度過低:
adb shell settings put system screen_brightness 255
- 充電器接上時啟動:
adb reboot bootloader
fastboot oem off-mode-charge 1
fastboot reboot
- 啟用模擬位置:
adb unroot
adb shell cmd location set-location-enabled true
adb root
adb shell appops set 0 android:mock_location allow
adb shell cmd location providers add-test-provider gps
adb shell cmd location providers set-test-provider-enabled gps true
adb shell cmd location providers set-test-provider-location gps --location 37.090200,-95.712900
#To verify
adb shell dumpsys location | grep "last location"
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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-27 (世界標準時間)。"],[],[],null,["# Pixel devices as development platforms\n\nThis guide is mainly for developers who want to test and develop using AAOS\n\nCaveats\n-------\n\nThese limitations apply when using a Pixel as development platforms:\n| **Caution:** There is a chance that you can brick your device when using Pixel as a development platform. If a device become bricked, have it repaired by [Google Support.](https://store.google.com/magazine/support)\n\n- The Pixel Tablet is verified and supported. You can visit\n [Google Store](https://store.google.com/product/pixel_tablet) to purchase it.\n\n- The following devices are supported but not actively tested. Be sure to download the correct binaries and then follow the instructions and change the commands as required:\n - Pixel 7, 7a and 7Pro\n - Pixel 8 and 8Pro\n- You *must* use Android 14 , build\n [android-14.0.0_r30](/setup/start/build-numbers#source-code-tags-and-builds).\n\n- Limited support for Bluetooth profiles and some of the profiles will not work at all\n- Tablet does not support GPS, location requires \"mock location app or similar\"\n\nPrerequisites\n-------------\n\nBefore you continue, confirm you have the following items:\n\n1. **OEM unlocking is required.**\n2. **Linux desktop capable of building Android code.** For more information, see [Establishing a Build Environment](/setup/build/initializing).\n\nCode sync and build\n-------------------\n\n1. To sync Android build AP1A.240405.002 : \n\n ```scdoc\n mkdir aaos_on_pixel\n cd aaos_on_pixel\n REPO_ALLOW_SHALLOW=0 repo init -c -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r30 --use-superproject --partial-clone --partial-clone-exclude=platform/frameworks/base --clone-filter=blob:limit=10M \n repo sync -j32\n ```\n2. Download the vendor image for pixel devices from [developers.google.com](https://developers.google.com/android/drivers) for AP1A.240405.002 \n\n ```scdoc\n curl --output - https://dl.google.com/dl/android/aosp/google_devices-tangorpro-ap1a.240405.002-8d141153.tgz | tar -xzvf -\n tail -n +315 extract-google_devices-tangorpro.sh | tar -zxvf -\n ```\n3. Take a patch \n\n ```carbon\n cd packages/services/Car\n git fetch https://android.googlesource.com/platform/packages/services/Car refs/changes/83/3037383/2 && git cherry-pick FETCH_HEAD #fix the audio crash\n cd -\n ```\n4. Run the build. : \n\n ```scdoc\n . build/envsetup.sh\n lunch aosp_tangorpro_car-ap1a-userdebug\n m\n ```\n5. Build the Automotive-related packages: \n\n ```objective-c\n m android.hardware.automotive.vehicle@2.0-default-service android.hardware.automotive.audiocontrol-service.example \n ```\n\nSet up the device to flash the build\n------------------------------------\n\nIf you haven't already done so, enable **Developer options**. Go to Settings \\\u003e\nSystem \\\u003e About Phone and then tap Build Number seven times.\n\nWhen you've enabled Developer options:\n\n1. Go to Settings \\\u003e System \\\u003e Developer options and enable **USB debugging** and **OEM unlocking**:\n\n|---|---|\n| | |\n\nFlash the build\n---------------\n\n1. To place the device into fastboot mode and then unlock it: \n\n ```gdscript\n adb reboot bootloader\n fastboot flashing unlock\n ```\n2. On the device, select Unlock the Bootloader. Doing so erases ***all*** data on the device!\n3. To flash the build: \n\n ```text\n fastboot -w flashall\n ```\n4. After the build start booting with animation:\n 1. To enable `adb remount`: \n\n ```text\n #Temporary disable the userdata checkpoint \n adb wait-for-device root; sleep 3; adb shell vdc checkpoint commitChanges; sleep 2 \n #Enable remount\n adb remount && sleep 2 && adb reboot && echo \"rebooting the device\" && adb wait-for-device root && sleep 5 && adb remount\n ```\n 2. To push the required Automotive-specific files to the device: \n\n ```text\n adb sync vendor && adb reboot\n ```\n 3. Wait for the device to start: \n\n Tips\n ----\n\n5. If you see screen brightness too low: \n\n ```scdoc\n adb shell settings put system screen_brightness 255\n ```\n6. Boot when charger is plugged in: \n\n ```gdscript\n adb reboot bootloader \n fastboot oem off-mode-charge 1\n fastboot reboot\n ```\n7. Enable Mock location: \n\n ```scdoc\n adb unroot\n adb shell cmd location set-location-enabled true\n adb root\n adb shell appops set 0 android:mock_location allow\n adb shell cmd location providers add-test-provider gps\n adb shell cmd location providers set-test-provider-enabled gps true\n adb shell cmd location providers set-test-provider-location gps --location 37.090200,-95.712900\n #To verify\n adb shell dumpsys location | grep \"last location\"\n ```"]]