Android disables lint “unused declaration” for the entire project

In an Android library project, I have many unused declarations because they are mainly called from outside the project. I use lint via

I don't want to use it

@SurpressWarning("unused")

On each file

If I try to disable it with the same ID in the gradle file

android {
    lintOptions {
        disable 'unused'
    }
}

Linter still has an "unused declaration" error

I also tried it by creating a lint. XML file in the project root directory

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <!-- list of issues to configure -->
    <issue id="unused" severity="ignore" /> 
</lint>

But it is still invalid. Does anyone know the correct lint ID?

resolvent:

You can use analyze – > to check the code, and then right-click one of the warnings. You will see an option called "disable checking":

Just click it and you won't have to worry about unused declarations in your project

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>