針對 Android (Go 版本) 進行最佳化調整
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Android (Go 版本) 的使用者數量增長迅速,因此必須針對現有應用程式進行最佳化調整,以便在這些 RAM 較少的裝置上發揮最佳效能。在這類開發中,最常見的挑戰是限制某些應用程式的功能、縮短啟動時間,以及處理應用程式中的記憶體壓力。這時針對 Android (Go 版本) 最佳化應用程式就能派上用場。
方法
開始進行應用程式最佳化前,請按照下列步驟操作。本指南說明如何設定基準,確定可以改善的領域,以及如何解決發現的問題。
階段 |
說明 |
定義 |
開始最佳化之前,請務必針對您為應用程式確定的改善領域定義主要成效指標 (KPI)。一些常見的改善領域包括應用程式啟動延遲、應用程式當機率或應用程式無回應 (ANR)。
定義這些 KPI 後,應從最低使用者體驗和基準化角度建立目標門檻,在使用者體驗和技術複雜度之間取得平衡。
|
逐步解析 |
建議您將這些改善領域細分為個別信號指標。舉例來說,應用程式當機率可按照當機原因分門別類,例如未處理的錯誤、高記憶體使用率或 ANR。 |
基準測試 |
接下來,您可以對確定的改善領域進行基準測試,以確定目前效能。如果未達到目標,請嘗試查看個別分析項目以找出瓶頸。 |
重複相同程序 |
對特定瓶頸進行最佳化後,請重複基準化程序以檢視可能改善的項目。如果未達到預先定義的 KPI 目標,可以重複執行第二次疊代的程序。 |
新增一般迴歸測試 |
定期執行迴歸測試,讓應用程式能根據您的 KPI 識別迴歸問題。在迴歸或錯誤進入程式碼集之前加以識別和切斷會更有效。除非您決定更新 KPI 目標,否則請勿發布任何未達成 KPI 目標的變更。 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Optimize for Android (Go edition)\n\nAndroid (Go edition) has a rapidly growing user base, and with that comes the\nneed to optimize existing applications to perform well on these low-RAM devices.\nSome of the most common challenges around this type of development requires\nlimiting some app features or capabilities, improving startup time, and handling\nmemory pressure within your app. That's where optimizing your app for Android\n(Go edition) can help.\n\nApproach\n--------\n\nFollow the steps below before beginning your app optimization approach. This\nguidance helps establish a baseline for identifying potential areas for\nimprovement and how to resolve your findings.\n\n| Phases | Description |\n|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Define | Before starting any optimization effort, it's important to define Key Performance Indicators (KPIs) around areas of improvement that you're targeting for your app. Some common improvement areas include app startup latency, app crash rate, or application not responding (ANRs). \u003cbr /\u003e Once these KPIs have been defined, you should establish target thresholds from a minimum user experience and benchmarking perspective, balancing user experience and technical complexity. |\n| Breakdown | It's recommended to break these improvement areas into individual signal metrics. For example, app crash rates can be categorized granularly into reasons for the crash --- such as unhandled errors, high memory usage, or ANRs. |\n| Benchmark | Next, you can benchmark the targeted improvement area to identify current performance. If your targets aren't met, try to identify the bottlenecks by looking at individual breakdowns. |\n| Repeat the process | After optimizing certain bottlenecks, repeat the benchmarking process to view potential improvements. If your pre-defined KPI targets aren't met, then you can repeat the process for a second iteration. |\n| Add regular regression tests | Regular regression tests can run at any frequency you desire for your app to identify regressions against your KPIs. It's more efficient to identify and cut off any regressions or bugs before they make their way into your codebase. Don't publish any changes that fail your KPI goals unless you make the decision to update your KPI targets. |"]]