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 |