我正试图摆脱我的 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.
如果您确保布局文件运行没有问题,您可以禁用检查:
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/