Saturday, June 23, 2012

Remove unused resource from Android project


  1. Run lint under '/SDK/tools/lint',  save the output to file.
    • lint . |grep 'to be unused' > /tmp/unused.txt
  2. Remove all unused resouces.
    • rm `cat /tmp/unused.txt | gawk -F: '{print $1}' |sed -e 's/  *$//'|grep png`
  3. Rebuild the project with 'ant release'.