I would like to be able to run the lint task when I'm building projects with the android studio to ensure the lint rules are being followed.
I have tried using task dependencies but with no luck. My TeamCity build server uses the build task which runs the lint task so that works great. However, the android studio appears to use generateDebugSources
and compileDebugJava
tasks interchangeably when I have selected the debug build variant.
Here is what I have tried in my build.gradle:
assemble.dependsOn lint
If you just want to configure your Android Studio project to run the lint check before the default run configuration without affecting how your gradle tasks are configured, you can follow these steps.
:app:check
)check
step before the existing Gradle-aware make
stepNow, Android Studio will run the lint check and fail the build if any lint errors occur.