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

StackOverflow https://stackoverflow.com/questions/10146351

  •  31-05-2021
  •  | 
  •  

Вопрос

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?

Это было полезно?

Решение

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.

Другие советы

In Eclipse:

First

Right click on project > Android Tools > Clear Lint Markers

Then

Right click on project > Android Tools > Run Lint: Check for Common Errors

Command Line: (Following the example above)

First

rm -rf ./project_directory/lint_report

Then

Run Lint again

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top