Android Resources Checker

Inspect the resources of your android projects and understand which ones are not being used and could potentially be removed.

What

This program will inspect the resources of your app and help you understand which ones are not being used and could
potentially be removed.

Main features:

  • Identify the unused resources in your android project.
  • Identify the unused resources in your android library (when you have a multi-repo setup)
  • Listing of the unused resources (name, type and size)
  • Deletion of the unused resources

Installing

This program requires Python, supporting from 3.8.x and 3.9.x

In order to install run:

pip install -U android-resources-checker

Using

Inspecting your app resources.

Imagining your app in the project subject-app, you can trigger the resources inspection by running:

android-resources-checker --app /path/to/subject-app

Inspecting your library app resources.

In the case you have two projects in separate repos, where a client-app depends on a lib-app, you can check the
unused resources of the library app by running:

android-resources-checker \
  --app /path/to/lib-app \
  --client /path/to/client-app-1 \
  --client /path/to/client-app-2

An example of a run could look like this:

android-resources-checker

Reports

The default behavior is to generate reports on both the stdout and CSV.

You can specify a single type of report using the --report=(CSV|STDOUT) option.

If using CSV reports, you can specify the directory where to write the reports in the form of CSV files. For that use
the --reports-dir option.

For example:

android-resources-checker \
  --app /path/to/app \ 
  --reports-dir /path/to/reports

Validation

There is also the option to run this as a validation tool. In this case, it will fail with an error if any unused
resources are found.

To specify the validation use the --check flag (the default behavior is to perform no validation).

Automatic Deletion

You can use this tool to also delete the unused resources by using the --delete option.

GitHub

https://github.com/fabiocarballo/android-resources-checker