Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Unused Resources before shipping

Question:

Does anyone have a quick way for removing all the extra resources in an Android application that are not being used(referenced) in my code?

Explanation:

I've noticed that once I finally get one of my Android applications ready to ship, there are usually a lot of unwanted resources within my application. I usually have some extra drawables that aren't being used because I switched them out with new ones. I also have extra String resources and even some extra layouts that aren't used anywhere in my application (there is no reference to them in the java code). I want my applications to take up the least amount of space possible on the user's phone.

like image 524
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Avatar asked Dec 21 '22 00:12

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz


2 Answers

Yes, the ADT in Eclipse includes something called "android lint".

http://tools.android.com/tips/lint

In a nutshell, it points out problems with your app. One thing it notes is unused resources. It doesn't automatically remove them.

You can access it from Eclipse through (right click project) > android tools > run lint.

like image 174
Jeffrey Blattman Avatar answered Jan 09 '23 07:01

Jeffrey Blattman


besides the builtin Lint: http://code.google.com/p/android-unused-resources/

it can't remove them automatically but it should be able to tell you which resources are unused.

like image 36
zapl Avatar answered Jan 09 '23 05:01

zapl