Lint 支持

你可以为特定 variant 运行 lint,例如 ./gradlew lintRelease,或为所有 variants 运行(./gradlew lint),这种情况下会生成一份包含特定版本存在的问题的详细报告。你可以像下面的代码片段那样通过配置 lintOptions 节点来配置 lint。一般只能配置小部分选项,查看 DSL reference 了解所有可修改的选项。

  1. android {
  2. lintOptions {
  3. // turn off checking the given issue id's
  4. disable 'TypographyFractions','TypographyQuotes'
  5. // turn on the given issue id's
  6. enable 'RtlHardcoded','RtlCompat', 'RtlEnabled'
  7. // check *only* the given issue id's
  8. check 'NewApi', 'InlinedApi'
  9. }
  10. }