Monday, 15 December 2014

Configure Jenkins for Android - Lint

Lint is a great tool created by Google to analyse the code for Android. It comes with the SDK of Android and it is useful to have good quality code.

Jenkins integrates Lint plugin which could be used to show result of Lint. To run Lint on Jenkins follow the steps:

1. Install Lint plugin on Jenkins
1.1 On the main page of Jenkins, go to Manage Jenkins -> MAnage Plugins
1.2 Go to "Available" tab
1.3 Look for a plugin called "Android Lint Plugin". Check it and click on "Download now and install after restart"
1.4 On the new screen, check "Restart Jenkins when installation is complete and no jobs are running"

2. Configure Jenkins to run Lint
2.1 Go to the configuration of the job on Jenkins
2.2 On the Build block, click on "Add build step" and select execute shell
2.3 Paste the follow command on the dialog

# Run lint
$ANDROID_HOME/tools/lint --xml lint-results.xml .

Make sure that the variable $ANDROID_HOME is defined.

This command will run Lint in the workspace directory and put the result on a xml file called lint-result.xml

3. Configure Jenkins to show Lint result
3.1 In the same page of configuration of the job, look for the block called "Post-build Actions"
3.2 Click on "Add post-build action" and select "Publish Android Lint result"
3.3 Fill the filed called "Lint files" with


No comments:

Post a Comment