Disable `lint` in Android gradle

Armand picture Armand · Jul 22, 2015 · Viewed 18.2k times · Source

From the Android Tools Project Site's Android Gradle Plugin User Guide I'm aware that it's possible to prevent Android's lint from aborting a build using:

lintOptions {
    abortOnError false
}

I'm also aware that lint can be disabled for release builds:

lintOptions {
    checkReleaseBuilds false
}

However, is it possible to completely disable lint when running e.g. gradle assembleDebug?

I'm aware of the risks and for this particular project it is wasting a fair amount of time given all the build flavors we have.

Answer

Sneh Pandya picture Sneh Pandya · Jan 17, 2019

Surely you can do this by adding this line in your gradle.properties file:

gradle=build -x lint -x lintVitalRelease

Warning: The above line will prevent running lint for both debug and release builds!

If you want to find out more gradle hacks, speedy builds, performance improvements, this will be the best slides you'll be looking at: Mastering Gradle 3.0

I prepared this from a lot of different resources including Android Developer & Gradle documentation, Android Developer videos, etc - hope it helps! It really makes a huge difference in build times (incremental as well as project load time)