Search code examples
androidandroid-lint

Does Android Lint cache old results someplace, and if so, how do I clear it?


I've been cleaning up Lint warnings on my Android project, but some of them seem to persist even after I've fixed them.

For example, I got this warning:

Use android.util.FloatMath#sqrt() instead of java.lang.Math#sqrt to avoid argument float to double conversion

Hey, good to know. I learned something. So I correct the error (and I tried both converting my math to use double and changing Math for FloatMath) and rerun my Lint report. The warning still appears! What's more, the little code snip that appears in the HTML report is of the same line as before, but since I moved some code around, what's displayed is no longer relevant. So it seems like Lint is caching the results of the previous runs somehow, but I haven't figured out how to clear that out.

I'm using command-line Lint and generating an HTML report from the results, if that's relevant. I'm using the following command, which outputs a multi-file HTML report in the lint_report directory and scans the Android project in project_directory.

$ lint --html lint_report/ project_directory/

Can I clear out old results for Android Lint somehow, or is this a bug?


Solution

  • It turns out that Android Lint uses the compiled class files to do its reporting. The answer is simply to rebuild the app before running the Lint report.