Incorrect warning about using Android Lint on unused resources

After starting Lint in Eclipse, it displays a list of unused resources, mostly available. Some of them are incorrect. He says some resources are not used, but in fact it is actually used in array.xml.

eg. Resource R.drawable.test not used

In array.xml

<string-array name="icon">
        <item>test</item>
</string-array>

Then in my work I use the following code to retrieve a resource

String[] icon = getResources().getStringArray(icon);
iconRes = getResources().getIdentifier(icon[itemPos], "drawable", this.getPackageName());

I tried running lint in the terminal, and it gave the same result.

+4
source share
1 answer

Lint often creates false positives for unused resources.

Information Ignore Warning (Window/Preferences/Android/Lint Error Checking/Performance/UnusedResources).

enter image description here

+4

Source: https://habr.com/ru/post/1537915/


All Articles