自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
套件管理工具設定 (已淘汰)
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
套件管理員中的 dexopt 實作方式僅適用於 Android 13 以下版本。在 Android 14 中,它已由 ART 服務取代,並會在下一個版本中從套件管理員中移除。如要瞭解如何設定 ART 服務,請參閱「ART 服務設定」。
自 Android 7.0 起,您可以透過一般方式指定在不同階段發生的編譯/驗證層級。您可以透過系統屬性設定編譯層級,預設值如下:
pm.dexopt.install=speed-profile
這是透過 Google Play 或其他應用程式商店安裝應用程式時使用的編譯篩選器。建議將安裝篩選器設為 speed-profile
,以便使用 dex 中繼資料檔案中的設定檔 (請參閱網誌)。請注意,如果未提供設定檔或設定檔為空白,speed-profile
就等同於 verify
。
pm.dexopt.bg-dexopt=speed-profile
這是裝置閒置且充電時使用的編譯篩選器。請試用 speed-profile
編譯器篩選器,充分利用設定檔引導的編譯作業,並儲存在儲存空間中。
pm.dexopt.boot-after-ota=verify
無線更新後使用的編譯篩選器。我們強烈建議您為此選項使用 verify
編譯器篩選器,以免啟動時間過長。
pm.dexopt.first-boot=verify
-
裝置首次啟動時的編譯篩選器。這裡使用的篩選器只會影響工廠模式後的啟動時間。建議使用篩選器 verify
,避免使用者第一次使用手機時,等待時間過長。請注意,如果系統映像檔中的所有應用程式都已使用 verify
、speed-profile
或 speed
搭配正確的類別載入程式內容編譯,則系統會略過首次啟動時的編譯作業,pm.dexopt.first-boot
就不會生效。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Package Manager Configuration (deprecated)\n\nThe dexopt implementation in the package manager only applies to Android\n13 and lower. In Android 14, it is replaced by ART\nService, and it will be removed from the package manager in the next version. For information about\nconfiguring ART Service, see\n[ART Service Configuration](/docs/core/runtime/configure/art-service).\n\n\nSince Android 7.0, there's a generic way to specify the level of\ncompilation/verification that happened at various stages.\nThe compilation levels can be configured via system properties\nwith the defaults being:\n\n- `pm.dexopt.install=speed-profile`\n- This is the compilation filter used when installing applications through Google Play or other app stores. We recommend the install filter be set to `speed-profile` in order to enable the use of profiles from the dex metadata files (see [blog](https://android-developers.googleblog.com/2019/04/improving-app-performance-with-art.html)). Note that if a profile isn't provided or if it is empty, `speed-profile` is equivalent to `verify`.\n- `pm.dexopt.bg-dexopt=speed-profile`\n- This is the compilation filter used when the device is idle and charging. Try the `speed-profile` compiler filter to take advantage of profile-guided compilation and save on storage.\n- `pm.dexopt.boot-after-ota=verify`\n- The compilation filter used after an over-the-air update. We **strongly** recommend the `verify` compiler filter for this option to avoid very long boot times.\n- `pm.dexopt.first-boot=verify`\n-\n The compilation filter for the first time the device ever boots. The filter\n used here only affects the boot time after factory. We recommend the filter\n `verify` for it to avoid long times before a user gets to\n use the phone for the very first time. Note that if all applications in\n the system image are already compiled with `verify`, `speed-profile`, or\n `speed` with the right class loader context, the compilation on the first boot will be\n skipped, and `pm.dexopt.first-boot` will have no effect."]]