I used the source code of the Android application, which we created in the past as the basis for another application (many functions are similar, but about 1/3 of the functionality of the original application is removed).
I started by copying the source tree and importing the new project into the Eclipse workspace. After that, I deleted some layouts and files with the ability to draw, and several .java files - those that are clearly not needed in the new application.
Finally, I compiled and tested a new application. Now I would like to do a more thorough cleaning of the project, removing almost everything that is not used.
What is the best way to find all the XML and image files, Java files, strings and color resources that are not used in the new application? “Not used”, I mean that they are not referenced by any of the executable code of the application (starting from the main action, they go to all other files specified in it, files transferred from these files, etc. )
The project contains hundreds of Drawables (many of them have versions in HDPI, MDPI and LDPI), about a hundred or so layouts, and about a thousand Java files in a dozen different packages. Therefore, checking them one by one is not an option.
Edit March 2012: The latest version of the Android SDK lint tool pretty well identifies unused resources. The problem is filtering messages about unused resources from hundreds of other messages that I received. When I launched the link to my medium-sized project, I had over 3,000 warnings, most of which I intend to do nothing, because lint cannot analyze what I am doing in the code with my XML layouts.
Aleks G
source share