Different lint.xml for different build types in Android Studio?

前端 未结 4 1195
[愿得一人]
[愿得一人] 2021-02-13 13:39

I want to use different lint.xml files for release and debug build types in Android Studio. So, how can this be achieved?

When

4条回答
  •  一生所求
    2021-02-13 14:07

    With kotlin build scripts (build.gradle.kts):

    tasks.withType().configureEach {
        // doFirst is required else we get a Null Pointer Exception on lintOption
        doFirst {
            // This will override the lintOptions from the android extension
            lintOptions.run {
                if (name.toLowerCase().contains("debug")) {
                    // Do your configuration here
                    // isAbortOnError = true
                    // baselineFile = file("baseline.xml")
                    // isWarningsAsErrors = true
                    // isCheckDependencies = true
                    // ignore("MissingTranslation")
                    // setLintConfig(file("lint.xml"))
                }
            }
        }
    }
    

提交回复
热议问题