lint檢查對於app來講也是很重要的,能夠檢查出不少問題。
lint配置
從stackoverflow上扒了一個配置。html
android {
android
lintOptions {
app
// true--關閉lint報告的分析進度
gradle
quiet true
ui
// true--錯誤發生後中止gradle構建
code
abortOnError false
xml
// true--只報告error
htm
ignoreWarnings true
文檔
// true--忽略有錯誤的文件的全/絕對路徑(默認是true)
get
//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'
}
}