How Do We Configure Android Studio to Run Its Lint on Every Build?

Lint should be running in Android Studio unless you have configured it to be off via the lintOptions in your build.gradle file.

Here is from the documentation found at http://developer.android.com/tools/debugging/improving-w-lint.html#studio

In Android Studio, the configured lint and IDE inspections run
automatically whenever you build your app. The IDE inspections are
configured along with the lint checks to run IntelliJ code inspections
to streamline code review.

Note: To view and modify inspection severity levels, use the File > Settings > Project Settings menu to open the Inspection Configuration page with a list of the supported inspections.

With Android Studio, you can also run lint inspections for a specific
build variant, or for all build variants from the build.gradle file.
Add the lintOptions property to the android settings in the build
file. This code snippet from a Gradle build file shows how to set the
quiet option to true and the abortOnError option to false.

android {
    lintOptions {
       // set to true to turn off analysis progress reporting by lint
       quiet true
       // if true, stop the gradle build if errors are found
       abortOnError false
       // if true, only report errors
       ignoreWarnings true
       }
       ...
}

To manually run inspections in Android Studio, from the application or
right-click menu, choose Analyze > Inspect Code. The Specify
Inspections Scope dialog appears so you can specify the desired
inspection scope and profile.

Here are other lint options that you can add to your lintOptions block in your gradle build.gradle file: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Lint-support

Here is more information on android lint: http://developer.android.com/tools/help/lint.html

It use to be that you could add gradle tasks after certain actions in android studio.

  • Open up the Gradle tab on the right side of the screen
  • Select your task

Android Studio Gradle Tab

  • Right click on the task
  • Choose your execution action

Android Studio Execution Action

This should run the task when it has been scheduled for execution.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)