Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable `lint` in Android gradle

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.

like image 813
Armand Avatar asked Jul 22 '15 16:07

Armand


People also ask

How do I turn off lint check?

Queries related to “disable lint”Use // eslint-disable-next-line to ignore the next line. You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore the next line. Use /* eslint-disable */ to ignore all warnings in a file.

What is lint option in Android?

Android Studio provides a code scanning tool called lint that can help you to identify and correct problems with the structural quality of your code without having to execute the app or write test cases.

What is lint in Gradle?

The com.android.lint plugin is the “standalone” lint Gradle plugin which can be applied to any Kotlin or Java Gradle project. To configure this project, use a lint block to configure it, like this: apply plugin: 'kotlin' apply plugin: 'com.android.lint' lint { htmlOutput = file("lint-report.html") textReport = true }

What are lint warnings?

In many cases, lint warns you about incorrect, error-prone, or nonstandard code that the compiler does not necessarily flag. The lint program issues every error and warning message produced by the C compiler. It also issues warnings about potential bugs and portability problems.


1 Answers

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)

like image 166
Sneh Pandya Avatar answered Sep 20 '22 06:09

Sneh Pandya