Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single lint report in multi-modular Android project

Does anyone know if it's possible to have single Gradle task for Lint check in the multi-modular Android project? The aim is to have the only one HTML/XML report for all modules (app + a few Android libraries).

like image 853
sttimchenko Avatar asked Apr 02 '18 16:04

sttimchenko


People also ask

Where can I find lint report?

Run lint using the standalone tool If you're not using Android Studio or Gradle, you can use the standalone lint tool after you install the Android SDK Command-Line Tools from the SDK Manager. You can then locate the lint tool at android_sdk /cmdline-tools/ version /bin/lint .

What is lint in Gradle?

The Gradle Lint plugin is a pluggable and configurable linter tool for identifying and reporting on patterns of misuse or deprecations in Gradle scripts and related files.

What is lint baseline?

Integrating In An Existing Codebase Luckily, Android Lint makes it easy to start using lint by providing a baseline. A baseline lets you take a snapshot of your project and then uses the snapshot as a baseline for future inspection runs. To create a baseline add the following in your build. gradle file.


1 Answers

In order to do that configure android lint only in the module where other modules are used as dependencies and enable checkDependencies in lintOptions.

ex:

There is an application module called app which uses feature_1, feature_2, feature_3 library modules as dependencies, so set checkDependencies to true in lintOptions of app module build.gradle file.

android{

    lintOptions{

        checkDependencies true // <---
        xmlReport false
        htmlReport true
        htmlOutput file("${project.rootDir}/build/reports/android-lint.html")

    }
}

Note:

when you run ./gradlew lint this will generate reports for every dependency module at each modules build/reports directory, BUT a report with all lint issues related to the project will be generated at the specified location.


Reference: https://groups.google.com/d/msg/lint-dev/TpTMBMlwPPs/WZHCu59TAwAJ

like image 52
user158 Avatar answered Nov 08 '22 21:11

user158