android - "MissingRegistered"使用 com.google.android.material.* UI 组件时的 Lint 警告

标签 android android-layout android-gradle-plugin material-design lint

我正试图摆脱我的 Android 项目中的 Lint 警告。这样做我遇到了以下类型的我不理解的警告消息:

app\src\main\res\layout-land\event_settings_fragment.xml:25: Error: Class referenced in the layout file, com.google.android.material.textfield.TextInputLayout, was not found in the project or the libraries [MissingRegistered]
      <com.google.android.material.textfield.TextInputLayout
      ^

我的应用似乎运行良好,所以 com.google.android.material.textfield.TextInputLayout 类应该在项目中可用? 请注意,我确实在所有 com.google.android.material.* 类上收到此警告。

最佳答案

MissingRegistered

Summary: Missing registered class

Priority: 8 / 10 Severity: Error

Category: Correctness

NOTE: This issue is disabled by default!

You can enable it by adding --enable MissingRegistered

If a class is referenced in the manifest or in a layout file, it must also exist in the project (or in one of the libraries included by the project. This check helps uncover typos in registration names, or attempts to rename or move classes without updating the manifest file properly.

See: http://tools.android.com/tips/lint-checks

如果您确保布局文件运行没有问题,您可以禁用检查:

app/build.gradle

android{
    lintOptions{
        disable "MissingRegistered"
    }
}

或者在布局文件中添加tools:ignore="MissingRegistered"来禁止检查。

关于android - "MissingRegistered"使用 com.google.android.material.* UI 组件时的 Lint 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53947680/

相关文章:

java - Android项目构建失败: Java class duplication

安卓工作室 : Unregistered VCS root detected

java - 不循环 for 循环 - Java (android)

android - LinearLayout 未在 ScrollView 内扩展

android - ClassNotFoundException 当 "implementation"用于库的库依赖时

android - 在谷歌地图上方显示工具栏

android - 两个并排的 LinearLayouts,一个具有最小宽度

android - 单击选项卡不显示主页 Activity

java - 在 Java 中将损坏的字符转换为正确的值

Android 的 RelativeLayout 单元测试设置