Android Plugin DSL Reference 参考文档 :
lint 的问题 id 指的是执行
lint --list
命令 , 打印出的 有效问题 id ( Valid issue id’s ) :
D:\001_Develop\001_SDK\Sdk\tools\bin>lint --list
Valid issue categories:
Correctness
Correctness:Messages
Correctness:Chrome OS
Security
Performance
Usability:Typography
Usability:Icons
Usability
Accessibility
Internationalization
Internationalization:Bidirectional Text
Valid issue id's:
"ContentDescription": Image without contentDescription
"AddJavascriptInterface": addJavascriptInterface Called
"ShortAlarm": Short or Frequent Alarm
...
"WrongFolder": Resource file in the wrong res folder
"WrongThreadInterprocedural": Wrong Thread (Interprocedural)
D:\001_Develop\001_SDK\Sdk\tools\bin>
在上一篇博客中 , 生成的 lint 检查报告 , 其中左侧的 就是 问题 id , 如 " VectorRaster "
LintOptions ( build.gradle#android#lintOptions ) 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.LintOptions.html
LintOptions#fatal 配置 用于 设置 Lint 问题 id 或者多个 id 为 fatal 级别 ;
Lint 的 问题 id 指的是 Lint 检查 , 会检查出各种问题 , 问题 ID 就表示该问题的类型 ,
上述配置的作用是 , 如果检查出 该 问题 ID 对应的问题 , 则将其判定为 fatal 级别的问题 ;
LintOptions#fatal 配置原型 : fatal 方法是一个多态函数 , 可以传入 单个 String 字符串作为参数 , 也可以传入可变长度的 若干 String 字符串作为参数 ;
void fatal(String id)
Adds a severity override for the given issues.
void fatal(String... ids)
Adds a severity override for the given issues.
LintOptions#fatal 方法配置使用示例 :
lintOptions {
// 编译时遇到错误, 停止编译
abortOnError false
fatal ('ContentDescription')
}
LintOptions ( build.gradle#android#lintOptions ) 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.LintOptions.html
LintOptions#ignore 配置 用于 设置 Lint 问题 id 或者多个 id 为 ignore 级别 ;
Lint 的 问题 id 指的是 Lint 检查 , 会检查出各种问题 , 问题 ID 就表示该问题的类型 ,
上述配置的作用是 , 如果检查出 该 问题 ID 对应的问题 , 则将其判定为 ignore 级别的问题 ;
LintOptions#ignore 配置原型 : fatal 方法是一个多态函数 , 可以传入 单个 String 字符串作为参数 , 也可以传入可变长度的 若干 String 字符串作为参数 ;
void ignore(String id)
Adds a severity override for the given issues.
void ignore(String... ids)
Adds a severity override for the given issues.
LintOptions#ignore 方法配置使用示例 :
lintOptions {
// 编译时遇到错误, 停止编译
abortOnError false
ignore ('ContentDescription')
}
LintOptions ( build.gradle#android#lintOptions ) 文档位置 : android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.LintOptions.html
LintOptions#warning 配置 用于 设置 Lint 问题 id 或者多个 id 为 warning 级别 ;
Lint 的 问题 id 指的是 Lint 检查 , 会检查出各种问题 , 问题 ID 就表示该问题的类型 ,
上述配置的作用是 , 如果检查出 该 问题 ID 对应的问题 , 则将其判定为 warning 级别的问题 ;
LintOptions#warning 配置原型 : warning 方法是一个多态函数 , 可以传入 单个 String 字符串作为参数 , 也可以传入可变长度的 若干 String 字符串作为参数 ;
void warning(String id)
Adds a severity override for the given issues.
void warning(String... ids)
Adds a severity override for the given issues.
LintOptions#warning 方法配置使用示例 :
lintOptions {
// 编译时遇到错误, 停止编译
abortOnError false
warning ('ContentDescription')
}