简体   繁体   中英

Globally set lintOptions in android studio gradle file

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 eg 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 ?

Create a new Gradle script file, eg 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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM