Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add release notes for 2.5.

Wiki Markup
{jenkins-plugin-info:android-lint}
Excerpt

Parses output from the Android lint tool and displays the results for analysis.


See also: Android Emulator Plugin.

...

This plugin builds on the work of the static analysis core plugin; see the Static Code Analysis Plug-ins page for a fuller list of features.

   

Requirements

  • Jenkins 12.596.1 7 or newer
  • The Static Analysis Utilities plugin — this will be automatically installed when you install this plugin
  • Android SDK Tools r17 or newer, but at least r21 is recommended

...

The most basic configuration is this, which will analyse any files in the workspace matching the default pattern **/lint-results*.xml:

Code Block

androidLint()

To specify the filenames or pattern to search for, use the pattern parameter:

Code Block

androidLint pattern: 'foo/bar/my-app_lint-results.xml'

To mark the build as unstable if there are more than 10 Lint warnings, and to mark the build as failed if there are more than 30 Lint warnings:

Code Block

androidLint unstableTotalAll: '10', failedTotalAll: '30'

To mark the build as failed if any high-priority warnings were introduced since the last build:

Code Block

androidLint failedNewHigh: '0'
Expand
titleDeprecated Pipeline syntax…

The syntax in this section is only required if you're using version 2.9 or older of the Pipeline Groovy Plugin, which was superseded in July 2016.

The most basic configuration is this, which will analyse any files in the workspace matching the default pattern **/lint-results*.xml:

Code Block

step([$class: 'LintPublisher'])

To specify the filenames or pattern to search for, use the pattern parameter:

Code Block

step([$class: 'LintPublisher', pattern: 'foo/bar/my-app_lint-results.xml'])

To mark the build as unstable if there are more than 10 Lint warnings, and to mark the build as failed if there are more than 30 Lint warnings:

Code Block

step([$class: 'LintPublisher', unstableTotalAll: '10', failedTotalAll: '30'])

To mark the build as failed if any high-priority warnings were introduced since the last build:

Code Block

step([$class: 'LintPublisher', failedNewHigh: '0'])

...

You can do this by adding a lintOptions block at the end of your android block in your build.gradle file:

No Format

android {
    // ...

    lintOptions {
        // Don't abort if Lint finds an error, otherwise the Jenkins build
        // will be marked as failed, and Jenkins won't analyse the Lint output
        abortOnError false
    }
}

...

You should use this to be ruthless about fixing Lint issues as they occur, and remember that you can exclude false positives by setting up a lint.xml file in the root of your app project.

Version history

Version 2.5 (September 9, 2017)

  • Fixed missing Lint graphs on Pipeline project pages (JENKINS-34621)
  • Fixed 404 error when trying to configure the graph from the job configuration page (JENKINS-41629)
  • Updated analysis-core dependencies to the latest
  • Raised the minimum Jenkins version to 2.7

Version 2.4 (August 27, 2016)

  • Integrated the Structs library plugin to give this plugin a short name ("androidLint") which allows for simplified syntax in plugins such as Pipeline
    • See the "Pipeline job configuration" section above for more details

...