Compose lint
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Android Lint 是一項功能強大的工具,可驗證程式碼的正確性或品質。強烈建議您在發布正式版應用程式前,修正所有 Lint 錯誤。
預設情況下,Compose 會提供多項 Lint 檢查。這有助於驗證 Compose 程式碼是否正確。
Compose 檢查的最低版本需求
為簡化相容性並提升 Lint 檢查支援的穩定性,Compose 1.9 需要 Android Gradle 外掛程式 (AGP) / Lint 8.8.2 以上版本。
如果您使用的 AGP 版本低於 8.8.2,且無法升級,可以在 gradle.properties
檔案中指定要使用的 Lint 版本:
android.experimental.lint.version = 8.8.2
先前,Compose Lint 檢查的複雜依附元件導致相容性問題頻傳,且難以判斷正確的工具版本 (Android Studio、AGP/Lint、Compose)。
Compose、AGP 和 Studio 的最低版本需求如下:
Compose 版本 |
所需 AGP / Lint 版本 |
必要 Studio 版本 |
1.9 |
8.8.2 以上版本 |
Ladybug+ |
1.8 |
8.6.0 以上版本 |
Koala 功能推送 -> Meerkat |
1.7 |
8.4.0 以上版本 |
Jellyfish -> Meerkat |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-09-03 (世界標準時間)。
[[["容易理解","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-09-03 (世界標準時間)。"],[],[],null,["[Android Lint](/studio/write/lint) is a powerful tool for verifying the correctness or\nyour code. It is highly recommended that you fix any identified lint errors\nbefore releasing your app to production.\n\nCompose ships with a number of lint checks by default. This helps verify the\ncorrectness of your Compose code.\n\nMinimum version requirement for Compose lint checks\n\nTo simplify compatibility and improve stability for lint check support, Compose\n1.9 requires Android Gradle Plugin (AGP) / Lint version 8.8.2 or higher.\n\nIf you're using an AGP version lower than 8.8.2 and are unable to upgrade, you\ncan specify the lint version to use in your `gradle.properties` file: \n\n android.experimental.lint.version = 8.8.2\n\nPreviously, the complex dependencies of Compose lint checks led to frequent\ncompatibility issues and made it difficult to determine the correct tool\nversions (Android Studio, AGP/Lint, Compose).\n\nMinimum version requirements for Compose, AGP, and Studio are as follows:\n\n|---------------------|---------------------------------|--------------------------------|\n| **Compose Version** | **Required AGP / Lint version** | **Required Studio version** |\n| 1.9 | 8.8.2+ | Ladybug+ |\n| 1.8 | 8.6.0+ | Koala Feature Drop -\\\u003e Meerkat |\n| 1.7 | 8.4.0+ | Jellyfish -\\\u003e Meerkat |"]]