Gradle配置lintOptions


lint檢查對於app來說也是很重要的,可以檢查出很多問題。 
lint配置 
從stackoverflow上扒了一個配置。

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'
    }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM