I am getting the following exception when I enable lint with baseline file configuration.
> Lint infrastructure error
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
.........................
.........................
Caused by: java.lang.IllegalStateException: path must not be null
at com.android.tools.lint.XmlReporter.writeIssue(XmlReporter.kt:209)
at com.android.tools.lint.XmlReporter.writeIssues(XmlReporter.kt:113)
at com.android.tools.lint.XmlReporter.write(XmlReporter.kt:99)
at com.android.tools.lint.LintCliClient.run(LintCliClient.java:288)
I added following lintOptions in my module build.gradle
After which I ran lintDebug gradle task.
android{
lintOptions {
baseline file("lint-baseline.xml")
warningsAsErrors true
abortOnError true
}
}
I was expecting my changes to create lint-baseline.xml file in module root directory for the first run and fail the build indicating creation of lint-baseline.xml. For the second run the lint should read lint-baseline.xml and suppress the existing error/warning reporting.
But the first run creates empty lint-baseline.xml and fails with Lint infrastructure error. The subsequent runs did not produce Lint infrastructure error but because the file is empty, the comparison fails resulting in errors/warnings.
My app has both java and kotlin files.