3

I have a multi-module project with a few Android apps and Android Library modules. It looks something like this:

├── awesomeapp (Android App)
├── coolapp (Android App)
└── modules 
    ├── usefulprojectA (Android Lib)
    └── usefulprojectB (Android Lib)

Both awesomeapp and coolapp depend on library modules:

implementation project(':modules:usefulprojectA:')
implementation project(':modules:usefulprojectB:')

What I would like to do is be able to say something like:

./gradlew awesomeapp:lint 

or even

./gradlew awesomeapp:build

And have the lint task execute on awesomeapp and on both usefulprojectA and usefulprojectB.

Currently the lint task would only apply to the top level project, i.e., awesomeapp. So if I wanted to Lint the subprojects I'd have to call the lint task on the subproject directly:

./gradlew modules:usefulprojectA:lint
./gradlew modules:usefulprojectB:lint

Plus call the main project:

./gradlew awesomeapp:lint

But that's clumsy and will make my build script longer in both time and size.

So how does one apply the Lint task to subprojects too?

1 Answer 1

5

You can check module and it's dependencies by adding checkDependencies true to your lintOptions:

android {
    lintOptions {
        checkDependencies true
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.