13

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.

2
  • so your baseline is not properly generated. I also have to builds (locally and CI) on different branches that cause lint infrastructure error, but with another stack trace. What AGP version are you using? I'm on 3.6.3 Commented Jun 17, 2020 at 8:12
  • i also found this: gitmemory.com/issue/vanniktech/lint-rules/304/621644575 do you use lintCheck instead of implementation ? Commented Jun 17, 2020 at 8:53

4 Answers 4

4

This might not be the best answer, but I tried, adding an old output.json into the APK destination folder and tried to build a signed apk, then the error was known, in which we have to delete the output.json file. This time after building the APK, it worked.

Again on the other day, the above method failed, I tried deleting the release folder and creating the APK again. This time it worked.

Sign up to request clarification or add additional context in comments.

Comments

3

i had this same issue, deleting the 'build' and 'release' folders. Somehow that worked for me. Don't know what actually caused it.

Comments

1

If the lint process successfully finished, you would get a appropriate result lint file. The error you get, shows the lint process has been failed in the first lint process run. After first run, the tools only read the empty file to determine the baseline. According to the reference you need manually delete the file and run lint process again to recreate it. for more information you can use "Analyze > Inspect Code" in menu on the Android Studio IDE or use command line with command :

$ ./gradlew lintDebug

in both manner you can find the location of the lint-baseline.xml as output

...

Wrote XML report to file:///app/lint-baseline.xml
Created baseline file /app/lint-baseline.xml

pay attention if you use command line in the terminal of Android Studio, you must use Ctrl + Enter for running the command. The output shows you a lot of useful information for debugging the problems.

Comments

-1

I also faced the same issue and tried all solutions. Later, I realized there was an issue in a CSV plugin for Android Studio I installed. Since I disabled the plugin and restart the android studio, everything is working fine.

1 Comment

I don't have any CSV plugin but i get the lint infrastructure error!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.