忽略Android lint中的几个警告

rds*_*rds 21 android lint android-resources

我知道我可以忽略属性中的Lint规则 tools:ignore

我的困难在于我想忽略几条规则.就我而言,对于Google分析ga_trackingId,我想忽略TypographyDashesMissingTranslation

我试过没有成功

<resources tools:ignore="TypographyDashes|MissingTranslation" xmlns:tools="https://schemas.android.com/tools" >
Run Code Online (Sandbox Code Playgroud)

<resources tools:ignore="TypographyDashes,MissingTranslation" xmlns:tools="https://schemas.android.com/tools" >
Run Code Online (Sandbox Code Playgroud)

<resources tools:ignore="TypographyDashes MissingTranslation" xmlns:tools="https://schemas.android.com/tools" >
Run Code Online (Sandbox Code Playgroud)

我现在没有想法.如何指定多个值tools:ignore

Gun*_*ein 34

您需要使用以逗号分隔的列表,但不能有空格.

例:

<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!
Run Code Online (Sandbox Code Playgroud)

有关有效选项的列表,您可以从命令行获取列表或使用throrin19提到的eclipse lint错误检查列表:

lint --list > lint_options.txt
Run Code Online (Sandbox Code Playgroud)

请参阅lint文档.

  • 这应该是接受的答案.干杯! (3认同)

har*_*ism 8

这里的问题是在xml资源文件中使用了错误的命名空间uri;

xmlns:tools="https://schemas.android.com/tools"
Run Code Online (Sandbox Code Playgroud)

这应该是http://...协议.这在43070号问题中有更详细的讨论