版權聲明:本文爲延成原創文章,轉載請標明出處
android {
lintOptions {
// true--關閉lint報告的分析進度
quiet true
// true--錯誤發生後停止gradle構建
abortOnError false
// true--只報告error
ignoreWarnings true
// true--忽略有錯誤的文件的全/絕對路徑(默認是true)
absolutePaths true
// true--檢查所有問題點,包含其他默認關閉項
checkAllWarnings true
// true--所有warning當做error
warningsAsErrors true
// 關閉指定問題檢查
disable'TypographyFractions','TypographyQuotes'
// 打開指定問題檢查
enable'RtlHardcoded','RtlCompat','RtlEnabled'
// 僅檢查指定問題
check'NewApi','InlinedApi'
// true--error輸出文件不包含源碼行號
noLines true
// true--顯示錯誤的所有發生位置,不截取
showAll true
// 回退lint設置(默認規則)
lintConfig file("default-lint.xml")
// true--生成txt格式報告(默認false)
textReport true
// 重定向輸出;可以是文件或'stdout'
textOutput'stdout'
// true--生成XML格式報告
xmlReport false
// 指定xml報告文檔(默認lint-results.xml)
xmlOutput file("lint-report.xml")
// true--生成HTML報告(帶問題解釋,源碼位置,等)
htmlReport true
// html報告可選路徑(構建器默認是lint-results.html )
htmlOutput file("lint-report.html")
// true--所有正式版構建執行規則生成崩潰的lint檢查,如果有崩潰問題將停止構建
checkReleaseBuilds true
// 在發佈版本編譯時檢查(即使不包含lint目標),指定問題的規則生成崩潰
fatal'NewApi','InlineApi'
// 指定問題的規則生成錯誤
error'Wakelock','TextViewEdits'
// 指定問題的規則生成警告
warning'ResourceAsColor'
// 忽略指定問題的規則(同關閉檢查)
ignore'TypographyQuotes'
}
}
實際應用 例如:
// 設置忽略國際化
lintOptions {
checkReleaseBuilds false
abortOnError false
}