【发布时间】:2022-09-29 20:06:25
【问题描述】:
我在项目的根目录下创建了一个lint.xml 文件,但 Android Studio 没有将那里定义的规则应用于我的源代码。
实际上,我需要两个存在于 Android Studio 检查中的规则(File -> Settings... -> Editor -> Inspections):
- 未使用的导入指令
- 冗余分号
在
Kotlin -> Redundant constructs我分别使用
UnusedImport和RedundantSemicolon名称生成警告和@Suppress它们,并且它工作正常。当我决定在
lint.xml文件中配置上述操作时,问题就出现了。为此,我在项目的根目录中创建了这个文件,如下所示。<?xml version=\"1.0\" encoding=\"utf-8\"?> <lint> <issue id=\"UnusedImport\" severity=\"error\" /> <issue id=\"RedundantSemicolon\" severity=\"error\" /> </lint>并以这种方式将它与我的
build.gradle文件中的 lint 扩展名链接起来lint { lintConfig = rootProject.file(\"lint.xml\") }你可以猜到它没有工作,我不知道为什么?
无论如何感谢您的帮助。
标签: android android-studio lint