8

How should I set Lint Option and VersionCode/Name globally for all modules I have 3 module and 1 application module for every module/build.gradle file I need to set as

lintOptions {
        checkReleaseBuilds false
        abortOnError false
}  

But I want to set this in project level e.g in /build.gradle I have try to paste above code in upper level gradle file but not work

allprojects {

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
} 

Is there any way to set this globally ?

Sushant Gosavi
  • 3,647
  • 3
  • 35
  • 55
  • I have check using project.ext { var } and use It work for version code and name but not for lint option , Please let me know if it is correct way or not – Sushant Gosavi Jul 17 '18 at 14:28

1 Answers1

12

Create a new Gradle script file, e.g. android-lint.gradle with the following contents:

android {
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

And then add this line below apply plugin: 'com.android.library' (or com.android.application) to every module:

apply from: '../android-lint.gradle'
italankin
  • 779
  • 8
  • 14
  • 2
    Thanks. I ended up using "apply from: "${rootDir}/android-lint.gradle" due to having some inconsistencies in module structure. – alannichols Jun 06 '19 at 16:08