提升性能
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
用户希望应用在启动和整个运行过程中都能提供运行畅快、反应灵敏的体验。检查应用是否存在性能问题后,您可以修复任何问题并提升应用的性能。
Android 提供了多种工具和库,可帮助您持续改进应用在最关键的时刻的性能。
基准配置文件
将基准配置文件实现到您的应用或库中,以最高效的方式提升性能。它可以大幅缩短应用启动时间、加快呈现速度并提高最终用户性能。如需了解详情,请参阅基准配置文件。
启动配置文件
启动配置文件是一项实验性功能,与基准配置文件类似,但应用方式有所不同,并且具有独特的优势。基准配置文件会在应用安装在设备上以后优化性能,而启动配置文件是在编译时应用的。它会提示 R8 缩减器在 DEX 文件中将常用类归为一组。这可以减少应用启动期间的页面故障,从而缩短启动时间。如需了解详情,请参阅 DEX 布局优化和启动配置文件。
App Startup 库
借助 App Startup 库,您可以进一步优化应用启动体验。库开发者和应用开发者都可以使用 App Startup 库来简化启动序列并优化启动操作。
针对低 RAM 设备进行优化
从底层开始改进性能。通过针对入门级设备进行优化,您可以提高应用在所有类别设备上的效率。使用内存有限的设备时,用户更有可能遇到应用启动延迟、应用无响应 (ANR) 或应用崩溃等问题。在应用的开发、基准化测试及其他测试中应考虑此市场细分,为应用打造基础性能。
Android(Go 版本)是 Android 平台操作系统的一种配置,可为低 RAM 设备提供优化的体验。如需详细了解如何针对入门级设备提高稳定性和性能,请参阅针对 Android(Go 版本)进行优化。
解决常见问题
如果可用的工具或库无法解决性能问题,我们建议检查以下各个类别的常见问题及其解决方案:
其他资源
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Improve performance\n\nUsers expect apps to be responsive and fast, from app startup and throughout the\nentire app experience. After you\n[inspect](/topic/performance/inspecting-overview) your app for performance\nproblems, you can fix any issues and improve your app's performance.\n\nTools and libraries\n-------------------\n\nAndroid provides multiple tools and libraries to continually improve the\nperformance of your app in production, where it matters the most.\n\n### Baseline Profiles\n\nImplement Baseline Profiles into your app or library for the most efficient way\nto improve performance. It can significantly optimize app startup time, reduce\nslow rendering, and improve performance for end users. To learn more, see\n[Baseline Profiles](/topic/performance/baselineprofiles).\n\n### Startup profiles\n\nStartup profiles is an experimental feature that is similar to Baseline\nProfiles, but is applied differently and has distinct benefits. Whereas a\nBaseline Profile optimizes performance as the app is installed on a device, a\nstartup profile is applied at compile-time. It gives the R8 shrinker hints to\ngroup commonly used classes together within the DEX file. This can reduce page\nfaults during app startup, and therefore improve startup times. To learn more,\nsee [DEX layout optimizations and startup\nprofiles](/topic/performance/baselineprofiles/dex-layout-optimizations).\n\n### App Startup library\n\nThe [App Startup library](/topic/libraries/app-startup) lets you further\noptimize the app startup experience. Both library developers and app developers\ncan use the App Startup library to streamline startup sequences and optimize\nstartup operations.\n\nOptimize for low-RAM devices\n----------------------------\n\nPerformance improvements begin from the ground-up. By optimizing for entry-level\ndevices, you can improve efficiency across all device categories. Users are more\nlikely to encounter issues such as app startup latency, application not\nresponding (ANRs), or app crashes when using memory-constrained devices.\nDevelop, test, and benchmark your app with this market segment in mind to create\na performant foundation for your app to build upon.\n\n[Android (Go edition)](/guide/topics/androidgo) is a configuration of the\nAndroid platform OS, which provides an optimized experience for low-RAM devices.\nTo learn more about improving stability and performance for entry-level devices,\nsee [Optimize for Android (Go edition)](/guide/topics/androidgo/optimize).\n\nSolve common problems\n---------------------\n\nIf the available tools or libraries don't resolve your performance issues, we\nrecommend checking for common problems and solutions in any of these categories:\n\n- [App startup](/topic/performance/vitals/launch-time)\n- [Slow rendering](/training/articles/perf-anr)\n- [Memory](/topic/performance/memory-overview)\n- [Battery and power](/training/monitoring-device-state/doze-standby)\n- [App size](/topic/performance/reduce-apk-size)\n\nAdditional resources\n--------------------\n\n- [Background work overview](/guide/background)\n- [Performance class](/topic/performance/performance-class)\n- [App Standby Buckets](/topic/performance/appstandby)\n- [App hibernation](/topic/performance/app-hibernation)"]]