Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android disable lint "unused declaration" for entire project

Tags:

In an android library project I have many unused declarations, cause they mostly get called from outside of the project. I use lint via

Analyze -> Inspect Code

I dont want to use

@SurpressWarning("unused")

on each file.

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

android {
    lintOptions {
        disable 'unused'
    }
}

The linter still comes up with the "Unused declaration" errors

I also tried it by creating lint.xml file in project root

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

But it still doesn´t work. Anyone know the correct lint ID?

like image 373
最白目 Avatar asked Aug 18 '17 13:08

最白目


1 Answers

You can use Analyze -> Inspect Code, then you right-click in one of the warnings. You will see there is an option called "Disable inspection":

Inspect code dialog

Just click on it and you won't need to worry about unused declarations in your project anymore.

like image 132
Amaury Medeiros Avatar answered Sep 29 '22 21:09

Amaury Medeiros