26

I know I can ignore a rule in Lint with attribute tools:ignore

My difficulty is that I want to ignore several rules. In my case, for Google analytics ga_trackingId, I want to ignore TypographyDashes and MissingTranslation

I tried with no success

<resources tools:ignore="TypographyDashes|MissingTranslation" xmlns:tools="https://schemas.android.com/tools" >

and

<resources tools:ignore="TypographyDashes,MissingTranslation" xmlns:tools="https://schemas.android.com/tools" >

and

<resources tools:ignore="TypographyDashes MissingTranslation" xmlns:tools="https://schemas.android.com/tools" >

I am now out of ideas. How can I specify several values in tools:ignore?

rds
  • 26,253
  • 19
  • 107
  • 134
  • 4
    According to documentation comma separated list should do this. See bottom of this developer page; http://developer.android.com/tools/debugging/improving-w-lint.html – harism Jan 22 '13 at 13:33
  • 1
    Thanks for the pointer @harism. I have opened [issue 43070](http://code.google.com/p/android/issues/detail?id=43070) – rds Jan 22 '13 at 13:48
  • @harism Good catch on the namespace; I'd like to credit you with the accepted answer – rds Jan 24 '13 at 11:19

4 Answers4

49

You need to use a comma separated list, but there must not be blanks.

Example:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" // required to work
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:ignore="contentDescription,SpUsage" > // comma separated list. NO blanks allowed!

For a list of the valid options you can get a list from the command line or use the eclipse lint error checking list mentioned by throrin19:

lint --list > lint_options.txt

See lint documentation.

Gunnar Bernstein
  • 6,074
  • 2
  • 45
  • 67
8

The problem here was usage of wrong namespace uri in xml resource file;

xmlns:tools="https://schemas.android.com/tools"

Which should have been http://... protocol instead. This is discussed in more details in issue 43070

rds
  • 26,253
  • 19
  • 107
  • 134
harism
  • 6,011
  • 1
  • 36
  • 31
  • In a word: don't follow the documentation and use the 'http' namespace instead :) – rds Jan 24 '13 at 20:54
2

Used you eclipse or intelliJ ?

In Eclipse, go to Window -> Preferences -> Android -> Lint Error Checking

enter image description here

And have a fun ;-)

throrin19
  • 17,796
  • 4
  • 32
  • 52
2

You can put multiple annotations on specific strings to ignore multiple lint checks:

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>    

    <!--suppress MissingTranslation -->
    <!--suppress TypographyDashes -->
    <string name="some_string">ignore my translation</string>
    ...

</resources>

http://tools.android.com/tips/lint/suppressing-lint-warnings

Eduard
  • 3,482
  • 2
  • 27
  • 45