自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
软件包管理器配置(已废弃)
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
软件包管理系统中的 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 和/或其关联公司的注册商标。
最后更新时间 (UTC):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"]],["最后更新时间 (UTC):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."]]