Compose lint
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android Lint 是一款用于验证代码正确性的强大工具。强烈建议您先修复所有已发现的 lint 错误,然后再发布正式版应用。
Compose 默认附带许多 lint 检查。这有助于验证您的 Compose 代码是否正确。
Compose lint 检查的最低版本要求
为了简化兼容性并提高 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 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Compose lint\n\n[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---------------------------------------------------\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 |"]]