Run lint when building android studio projects

To runt lint and analyze your project, simply select Analyze > Inspect Code.

You should get a nice window with all issues.

enter image description here

Also check Run lint in Android Studio for more information.


I did a little more research, try adding this to your build.gradle.

lintOptions {
      abortOnError true
  } 

There are many options that you can apply to the build.gradle


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.

  1. Open the run configurations drop down and choose edit

enter image description here

  1. Select your app run configuration

enter image description here

  1. Press the '+' to add a new step

enter image description here

  1. Choose "Gradle-aware Make"

enter image description here

  1. Type 'check' and choose the option with your app module name and check. (Mine is :app:check)

enter image description here

  1. Press the up arrow to move the new check step before the existing Gradle-aware make step

enter image description here

Now, Android Studio will run the lint check and fail the build if any lint errors occur.