4

I'd like to set strict lint checking on my CI and it would be nice if I could set the abortOnError bit for lint only when I run a release build. I've tried:

compileLint.doFirst {
    android.applicationVariants.each { variant ->
        android.lintOptions.abortOnError variant.name.endsWith('Release')
        println("variant.name? ${project.name}/${variant.name} abortOnError? ${android.lintOptions.abortOnError}")
    }
}

I also did the same thing with preBuild. When I run :app:lintProdRelease I do see that my task ran and the print says

app/prodRelease abortOnError true
app/prodDebug abortOnError false
app/mockDebug abortOnError false

But every time I run :app:lintProdRelease I see the lint error but the build succeeds. How can I configure lint check based on the build type?

TheHebrewHammer
  • 3,018
  • 3
  • 28
  • 45

0 Answers0