提升效能
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
使用者期待應用程式隨時都能快速回應,無論是在應用程式啟動期間,還是整個應用程式使用過程都一樣。檢查應用程式是否有效能問題後,您可以修正所有問題並改善應用程式效能。
Android 提供多種工具和程式庫,可在最重要的實際工作環境中,持續改善應用程式效能。
基準設定檔
在應用程式或程式庫中實作基準設定檔,是提高效能最有效率的方法。這可以大幅改善應用程式啟動所需的時間、減少轉譯速度緩慢的問題並提高效能,讓使用者享有更優質的體驗。詳情請參閱「基準設定檔」。
啟動設定檔
啟動設定檔是與基準設定檔類似的實驗功能,但套用的方式不同,且具有獨特優勢。基準設定檔會在應用程式於裝置上安裝時將效能最佳化,啟動設定檔則會在編譯期間套用。這可提示 R8 縮減器將 DEX 檔案內常用的類別分組在一起。這樣一來,頁面在應用程式啟動期間出錯的情況就可以減少,進而縮短啟動時間。詳情請參閱「DEX 版面配置最佳化和啟動設定檔」。
應用程式啟動程式庫
應用程式啟動程式庫可讓您進一步最佳化應用程式啟動體驗。程式庫開發人員和應用程式開發人員都能使用應用程式啟動程式庫簡化啟動序列,並改善啟動作業。
針對低 RAM 裝置進行最佳化
想從根本上改善效能嗎?只要針對入門級裝置進行最佳化,即可提昇在各類裝置上的效能。使用記憶體受限的裝置時,使用者較有可能遇到應用程式啟動延遲、應用程式無回應 (ANR) 或應用程式停止運作之類的問題。因此,當您在開發、測試應用程式,或是對應用程式進行基準測試時,請將這個市場區隔納入考量,奠定建構應用程式的卓越基礎。
Android (Go 版本) 是 Android 平台作業系統的一種設定,可為低 RAM 裝置提供最佳體驗。如要進一步瞭解如何針對入門級裝置提升穩定性和效能,請參閱「針對 Android (Go 版本) 進行最佳化調整」。
解決常見的問題
如果可用的工具或程式庫不能解決效能問題,建議您查看常見問題,瞭解如何解決下列類別的問題:
其他資源
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間: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)"]]