Live data from Hacker News

Android-resource-remover – utility to auto-remove unused Android resources

github.com

1–7 of 7 posts

Re: Android-resource-remover – utility to auto-remove unused Android resources

#4

When I run: android-resource-remover --lint On my projects root it gives me this[1]. Seems as if the tools is calling lint incorrectly. [1]: http://hastebin.com/apucalovak.vhdl

not sure what your project structure looks like, but you can always run lint separately (like in the gradle example) and then use --xml Then it will use the already existing lint output to remove the resources

Re: Android-resource-remover – utility to auto-remove unused Android resources

#5
I remember reading somewhere that lint might give false positives if you refer to resources in your Java code instead of the xml.

From the README:

If you have references to elements in an old layout that you're not using anymore, you will get a compile error that the ID (R.id.) can not be found. The reason is that the resource file that contained R.id. has been removed as it was not used any more. Time to clean up your code.

If there is a reference to the resource somewhere doesn't that mean that the resource is in use?

Re: Android-resource-remover – utility to auto-remove unused Android resources

#6
post #5

I remember reading somewhere that lint might give false positives if you refer to resources in your Java code instead of the xml. From the README: If you have references to elements in an old layout that you're not using anymore, you will get a compile error that the ID (R.id. ) can not be found. The reason is that the resource file that contained R.id. has been removed as it was not used any more. Time to clean up y…

we haven't encountered any problems with lint. Your app will just not compile and tell you whats missing.

The case from the readme is: We were loading view A. Then we looked for R.id.something in view A in a method.

Later we replaced view A with B, but never took out R.id.something that was referring to view A (it was also never used). This never caused problems as view A was still in the resources.

Lint marks view A as unused as no activity is ever loading it. After removing A, R.id.something can not be found anymore and you will get a compile error. It was time to remove that dead reference.

Re: Android-resource-remover – utility to auto-remove unused Android resources

#7

When I run: android-resource-remover --lint On my projects root it gives me this[1]. Seems as if the tools is calling lint incorrectly. [1]: http://hastebin.com/apucalovak.vhdl

in the output you can see how lint is called: 'Arguments for subprocess.call: ['/opt/adt/sdk/tools/lint', '.', '--xml', './lint-result.xml']'

try running it from the console.