NOTE: This document is a bit obsolete; if you arrived here recently via a search engine, read the more complete document about suppressing lint errors instead.
In addition to adding a lot of new lint checks, the new version of Lint in Tools 17 adds improved support for ignoring issues that you have manually verified and want to suppress.
The easiest way to do it is probably via the Lint toolbar window:
If you disable an issue in a project or file, this gets recorded in a special file named
The first button lets you ignore a specific issue encountered in a Java or XML file.
If the error is in a Java file, it adds a
The annotation takes a String parameter which lists the id of the issue to suppress. While the quickfix automatically supplies it, if you are editing manually you can also find the id listed at the end of each lint error message in the command line output as well as in the HTML reports.
To suppress more than one issue, supply a String array like this:
and you can also use
In XML files, you can use the new tools:ignore attribute in a similar way to suppress errors (see the third quickfix in the list which offers the suppress attribute):
Just as with Java annotations, this attribute is inherited, so you can specify it on the root of an XML document to suppress all warnings of the given type within the document. And just like the annotation, you can supply a comma separated list of issues (or "all") to suppress the given list of issues.
Note that the new tools namespace is special. AAPT in Tools 17 will deliberately skip these attributes, so they do not end up in the compiled XML shipped with your application, so there is no cost at runtime.
Recent Changes >