lint檢查對于app來說也是很重要的,可以檢查出很多問題。
android {
lintOptions {
// true--關(guān)閉lint報告的分析進(jìn)度
quiet true
// true--錯誤發(fā)生后停止gradle構(gòu)建
abortOnError false
// true--只報告error
ignoreWarnings true
// true--忽略有錯誤的文件的全/絕對路徑(默認(rèn)是true)
//absolutePaths true
// true--檢查所有問題點(diǎn),包含其他默認(rèn)關(guān)閉項
checkAllWarnings true
// true--所有warning當(dāng)做error
warningsAsErrors true
// 關(guān)閉指定問題檢查
disable 'TypographyFractions','TypographyQuotes'
// 打開指定問題檢查
enable 'RtlHardcoded','RtlCompat', 'RtlEnabled'
// 僅檢查指定問題
check 'NewApi', 'InlinedApi'
// true--error輸出文件不包含源碼行號
noLines true
// true--顯示錯誤的所有發(fā)生位置,不截取
showAll true
// 回退lint設(shè)置(默認(rèn)規(guī)則)
lintConfig file("default-lint.xml")
// true--生成txt格式報告(默認(rèn)false)
textReport true
// 重定向輸出;可以是文件或'stdout'
textOutput 'stdout'
// true--生成XML格式報告
xmlReport false
// 指定xml報告文檔(默認(rèn)lint-results.xml)
xmlOutput file("lint-report.xml")
// true--生成HTML報告(帶問題解釋,源碼位置,等)
htmlReport true
// html報告可選路徑(構(gòu)建器默認(rèn)是lint-results.html )
htmlOutput file("lint-report.html")
// true--所有正式版構(gòu)建執(zhí)行規(guī)則生成崩潰的lint檢查,如果有崩潰問題將停止構(gòu)建
checkReleaseBuilds true
// 在發(fā)布版本編譯時檢查(即使不包含lint目標(biāo)),指定問題的規(guī)則生成崩潰
fatal 'NewApi', 'InlineApi'
// 指定問題的規(guī)則生成錯誤
error 'Wakelock', 'TextViewEdits'
// 指定問題的規(guī)則生成警告
warning 'ResourceAsColor'
// 忽略指定問題的規(guī)則(同關(guān)閉檢查)
ignore 'TypographyQuotes'
}
}