Android lint tools seems only can detect unused resources but remove those resources. Is there any way to remove those unused resource automatically?
Update 2016-05: here's the final solution:
http://tools.android.com/tech-docs/new-build-system/resource-shrinking
--- old answer --- No as far as I know.
Are you using linux/Mac? I developed a script by myself to do this:
Layout files, execute in the layout directory:
for f in *; do f=`echo $f | sed 's/.xml//g'`; echo $f; grep layout.$f -r ../../src .. >/dev/null; if [ $? != 0 ]; then rm $f.xml;fi done
Pictures: execute in project root directory
find . -name "*png" -o -name "*jpg" | awk -F/ '{print $NF}'|awk -F. '{print $1}'|sort|uniq > imgs
for f in `cat imgs`; do echo $f; grep drawable.$f -r src res >/dev/null; if [ $? != 0 ]; then find res -name $f.* -exec rm {} \; ;fi; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With