android - 忽略 Android lint 中的几个警告

标签 android android-resources lint

我知道我可以忽略 Lint 中具有 tools:ignore

属性的规则

我的困难是我想忽略几个规则。 就我而言,对于 Google 分析 ga_trackingId,我想忽略 TypographyDashesMissingTranslation

我试过没有成功

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

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

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

我现在没有主意了。如何在 tools:ignore 中指定多个值?

最佳答案

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

例子:

<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!

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

lint --list > lint_options.txt

lint documentation .

关于android - 忽略 Android lint 中的几个警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14459679/

相关文章:

android - 在 Espresso 中使用 Dagger

java - 第一个应用程序(developer.android.com)错误,什么问题?

java - 使用像 android.R 这样的自定义命名空间创建 android 资源库?

android - 运行 GTM 诊断错误

android - 请在执行 SonarQube 之前构建项目并检查编译类的位置

android - 在 setLockscreenVisibility(Notification.VISIBILITY_SECRET) 之后,通知 channel 仍然出现在锁屏上

java - NETWORK_PROVIDER 未提供位置更新

android - 如何在 build.gradle 中使用最终解析的 applicationId

android - xml 资源中的警告

Gulp - SCSS Lint - 如果 linting 失败,不要编译 SCSS