33

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.

Armand
  • 23,463
  • 20
  • 90
  • 119
  • 1
    Love to be able to completely turn this off. Causing me huge problems in Gradle. – PlunkettBoy Dec 16 '15 at 21:19
  • 1
    See http://stackoverflow.com/questions/21143556/avoid-lint-when-gradle-execute-check/21148409#21148409 for a solution. – aha Jan 08 '16 at 18:28
  • 3
    Lint is slow, uses lots of CPU and promotes Android style of programming which contradicts sane way of programming. There's no point in keeping lint. – Martin Vysny Mar 27 '18 at 05:44
  • @MartinVysny I'm printing your words to hang them in the office's wall... god bless u. – Dimas Crocco Jan 17 '20 at 23:33

3 Answers3

24

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)

Sneh Pandya
  • 8,197
  • 7
  • 35
  • 50
18

Add following lines of code inside build.gradle(app).

android {
    lintOptions {
        checkReleaseBuilds false
        //If you want to continue even if errors found use following line
        abortOnError false
    }
}
Sushant Poman
  • 375
  • 2
  • 9
0

I had similar problem and used all below options

  • quiet true
  • abortOnError false
  • checkReleaseBuilds false

but at the end I found that clearing and invalidating cache would be a good option to settle the matter.