Android Studio lint.xml配置 [英] Android Studio lint.xml configuration
问题描述
我想在Android Studio中配置lint以忽略某些文件.我将 lint.xml 文件放置在 app/文件夹中.这是lint文件的内容:
I would like to configure lint in Android Studio to ignore some file. I have placed the lint.xml file in app/ folder. Here is the content of the lint file:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="UnusedResources">
<ignore path="res/drawable/background_palette_drawable_6.xml" />
</issue>
</lint>
当我运行lint检查未使用的资源时,它仍然发现此文件为未使用.
When I run lint to check for unused resources it still finds this file as unused.
在应用程序 build.gradle 中,我有:
lintOptions {
disable 'InvalidPackage'
abortOnError false
absolutePaths false
lintConfig file('lint.xml')
}
我尝试将文件路径更改为/app/src/main/res/drawable/background_palette_drawable_6.xml
仍然不起作用.
I have tried changing the file path to /app/src/main/res/drawable/background_palette_drawable_6.xml
and still it does not work.
我放入了<issue id="UnusedResources" severity="ignore">
,在这种情况下,它只是忽略所有未使用的资源,因此似乎可以正确找到文件lint.xml
,但路径可能有问题?
I put <issue id="UnusedResources" severity="ignore">
and in that case it just ignores all the unused resources so it seems the file lint.xml
is found correctly but maybe something is wrong with the path?
推荐答案
考虑将path="**/background_palette_drawable_6.xml"
与**
glob模式一起使用以匹配文件,而不管其位置如何.
Consider using path="**/background_palette_drawable_6.xml"
with the **
glob pattern to match the file regardless of its location.
这篇关于Android Studio lint.xml配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!