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

Overview

Android Resources Checker

Flake8 Black Coverage License

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:

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.

License


Copyright (c) 2021 Dotanuki Labs, Fabio Carballo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
Graphene Metanode is a locally hosted node for one account and several trading pairs, which uses minimal RAM resources.

Graphene Metanode is a locally hosted node for one account and several trading pairs, which uses minimal RAM resources. It provides the necessary user stream data and order book data for trading in a format one would expect from a centralized exchange API.

ARA Records Ansible and makes it easier to understand and troubleshoot.
ARA Records Ansible and makes it easier to understand and troubleshoot.

ARA Records Ansible ARA Records Ansible and makes it easier to understand and troubleshoot. It's another recursive acronym. What it does Simple to ins

All you need to understand CRUD and MVP in DRF
All you need to understand CRUD and MVP in DRF

Book-Store-API This an API which has been put in place just to make you order for books, upload books with price, image and all, pay and automtically

This repository provides a set of easy to understand and tested Python samples for using Acronis Cyber Platform API.

Base Acronis Cyber Platform API operations with Python !!! info Copyright © 2019-2021 Acronis International GmbH. This is distributed under MIT licens

🎅🏻 Helping santa understand ✨ python ✨

☃️ Advent of code 2021 ☃️ Helping santa understand ✨ python ✨

Users can read others' travel journeys in addition to being able to upload and delete posts detailing their own experiences

Users can read others' travel journeys in addition to being able to upload and delete posts detailing their own experiences! Posts are organized by country and destination within that country.

An open letter in support of Richard Matthew Stallman being reinstated by the Free Software Foundation

An open letter in support of RMS. To sign, click here and name the file username.yaml (replace username with your name) with the following content

Neogex is a human readable parser standard, being implemented in Python

Neogex (New Expressions) Parsing Standard Much like Regex, Neogex allows for string parsing and validation based on a set of requirements. Unlike Rege

Get information about what a Python frame is currently doing, particularly the AST node being executed

executing This mini-package lets you get information about what a frame is currently doing, particularly the AST node being executed. Usage Getting th

Comments
  • Issues with MIT licensing

    Issues with MIT licensing

    First of all, congrats for the good job on this tool. Looks quite great!

    It's quite hard to say that, but it seems that your project is not compliant with MIT license at all.

    The reason for that is simple : your project takes A LOT of inspiration from the open-source work I've been doing at @dotanuki-labs. Particularly it is easy to realise that when comparing this project with bitrise-reports

    I can list a few of them:

    • Same project structure driven by Poetry + Makefile (including some targets using the same names)
    • Same Github Actions Workflows (main.yml and publish.yml), incluing Job's names, Python versions, pipeline steps
    • Very similar file structure (entrypoint.py, reporting.py, app.py, etc)
    • Very similar file contents, as per entrypoint.py (from bitrise-reports) and entrypoint.py (from this project)

    Hell, even some lines of README look the same ... and this init kinda makes crystal clear that inspiration maybe went too far ...

    Open-source is meant to be collaborative and inspirational, yes. For sure I have no issues with people forking, modifying and/or re-distributing my code. Most likely that proves I'm in a good track at all.

    However, licensing is important. Attribution is important. This article does a terrific job elaborating on that

    I love inspiring other people to do awesome stuff based on some of my concepts and thoughts and 
    I’m happy when I could help you with my code. So everybody is free to use my code, but now the 
    important part, under the given license terms. You could also say “credit where credits needed”. 
    
    Open source in the context of software does not mean you can copy the nice stuff and paste 
    it into your project and tell everybody you did a nice job.
    

    I can't recommend enough also checking these two extra resources to understand how MIT license works :

    It's also worth to highlight that deploys on Pypiship the source code exactly as it was written, which means that you've shipped snippets and/or entire pieces of code written by me without proper attribution while re-distributing.

    All of that being said : I'd like to ask you to change your LICENSE.md and README.md files with the following notice

    Copyright (c) 2021 Dotanuki Labs, Fabio Carballo
    
    [rest of the license terms]
    

    so your project becomes compliant with MIT and plays well with open-source. I won't bother about previous releases wrongly copyrighted if you gently commit with this suggestion and deploy a new version of this project, so users can get the proper copyrighted code when installing / updating this tool.

    I'm assuming here this issue eventually comes from some lacking of experience with open-source from your end, and* that is totally fine. Knowing you from our days working together at N26 I'm 100% sure you don't need such copy+pasta over other Engineer's work.

    Thanks in advance

    opened by ubiratansoares 2
  • ERROR: Could not complete analysis.

    ERROR: Could not complete analysis.

    Hi, I'm trying to run this script on my project (muli-module setup) and I am having this problem:

    Processing:
    [14:52:52] rappi - packaged resources processed!                       app.py:31
    ERROR:root:Could not complete analysis.
    Traceback (most recent call last):
      File "/Users/usuario/.pyenv/versions/3.9.7/lib/python3.9/site-packages/android_resources_checker/entrypoint.py", line 81, in launch
        application.execute(app, client, check, delete)
      File "/Users/usuario/.pyenv/versions/3.9.7/lib/python3.9/site-packages/android_resources_checker/app.py", line 33, in execute
        usage_references = self.resources_fetcher.fetch_used_resources(app_path)
      File "/Users/usuario/.pyenv/versions/3.9.7/lib/python3.9/site-packages/android_resources_checker/resources.py", line 73, in fetch_used_resources
        styles_references = self._style_usages_in_xml(filepath)
      File "/Users/usuario/.pyenv/versions/3.9.7/lib/python3.9/site-packages/android_resources_checker/resources.py", line 113, in _style_usages_in_xml
        for line in self.files_handler.file_content(filepath):
      File "/Users/usuario/.pyenv/versions/3.9.7/lib/python3.9/site-packages/android_resources_checker/files.py", line 33, in file_content
        return open(filepath).readlines()
      File "/Users/usuario/.pyenv/versions/3.9.7/lib/python3.9/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 1: invalid continuation byte
    

    Python version: 3.9.7 OS: macOS Monterrey 12.0.1

    opened by GianfrancoMS 0
  • support multiple clients

    support multiple clients

    What

    • Renamed --app-path to --app
    • Renamed --client-path to --client
    • Add ability to provide multiple clients.
      • This is done via the --client flag; you should use one for each of the clients.
    opened by fabiocarballo 0
Releases(v0.0.10)
  • v0.0.10(Apr 8, 2021)

    Version 0.0.10

    2021-05-08

    • Specify automatic deletion of unused resources via the --delete flag.
    • Fixes bugs in deletion that incorrectly deleted entries in file and whole files.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.9(Apr 7, 2021)

    Version 0.0.9

    2021-04-07

    • Fix bug that was not considering resource names with '0' in the name.
    • Fix bug that was not considering all files of the project.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.8(Apr 7, 2021)

    Version 0.0.8

    2021-04-07

    • Add ability to use it as a validation tool using the --check option.
    • Specify the type of report using the --report=(CSV|STDOUT) (the default is to run all).
    • Fixes bug that didn't check for resource usages in the AndroidManifest.xml
    Source code(tar.gz)
    Source code(zip)
  • v0.0.7(Apr 4, 2021)

    Version 0.0.7

    2021.04.05

    • Add inspection to style resources.
    • Update LICENSE.md and README.md with due copyright to Dotanuki Labs given that the structure/base of this project was highly inspired from Bitrise Reports.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.6(Apr 2, 2021)

    Version 0.0.6

    2021-04-02

    • Add CSV reports via the --reports-dir option.
    • Fixes bug that ignored that didn't process resources that are not xml (such as the ones usually placed on raw)
    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(Apr 1, 2021)

    Version 0.0.4

    2021-04-01

    • Add inspection to resources declared as entries (string, color, dimen)
    • Renamed --app-path to --app
    • Renamed --client-path to --client
    • Add ability to provide multiple clients.
      • This is done via the --client flag; you should use one for each of the clients.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Mar 29, 2021)

    Version 0.0.3

    2021-03-29

    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
    Source code(tar.gz)
    Source code(zip)
Owner
Fábio Carballo
Fábio Carballo
The goal of this program was to find the most common color in my living room.

The goal of this program was to find the most common color in my living room. I found a dataset online with colors names and their corr

1 Nov 09, 2021
This script provides LIVE feedback for On-The-Fly data collection with RELION

README This script provides LIVE feedback for On-The-Fly data collection with RELION (very useful to explore already processed datasets too!) Creating

cryoEM CNIO 6 Jul 14, 2022
Check is a integer is even

Is Even Check if interger is even using isevenapi. https://isevenapi.xyz/ Main features: cache memoization api retry handler hide ads Install pip inst

Rosiney Gomes Pereira 45 Dec 19, 2022
Repository specifically for tcss503-22-wi Students

TCSS503: Algorithms and Problem Solving for Software Developers Course Description Introduces advanced data structures and key algorithmic techniques

Kevin E. Anderson 3 Nov 08, 2022
Stop ask your soraka to ult you, just ult yourself

Lollo's auto-ultimate script Are you tired of your low elo friend who can't ult you with soraka when you ask for it? Use Useless Support and just ult

9 Oct 20, 2022
Automated GitHub profile content using the USGS API, Plotly and GitHub Actions.

Top 20 Largest Earthquakes in the Past 24 Hours Location Mag Date and Time (UTC) 92 km SW of Sechura, Peru 5.2 11-05-2021 23:19:50 113 km NNE of Lobuj

Mr. Phantom 28 Oct 31, 2022
Python AVL Protocols Server for Codec 8 and Codec 8 Extended Protocols

pycodecs Package provides python AVL Protocols Server for Codec 8 and Codec 8 Extended Protocols This package will parse the AVL Data and log it in hu

Vardharajulu K N 2 Jun 21, 2022
A Linux program to create a Windows USB stick installer from a real Windows DVD or image.

WoeUSB-ng A Linux program to create a Windows USB stick installer from a real Windows DVD or image. This package contains two programs: woeusb: A comm

Longinus 1 Nov 19, 2021
Runtime inspection utilities for Python typing module

Typing Inspect The typing_inspect module defines experimental API for runtime inspection of types defined in the Python standard typing module. Works

Ivan Levkivskyi 284 Dec 29, 2022
SiliconCompiler is an open source compiler framework that automates translation from source code to silicon.

SiliconCompiler is an open source compiler framework that aims to automate translation from source code to silicon.

siliconcompiler 539 Jan 04, 2023
Projeto job insights - Projeto avaliativo da Trybe do Bloco 32: Introdução à Python

Termos e acordos Ao iniciar este projeto, você concorda com as diretrizes do Código de Ética e Conduta e do Manual da Pessoa Estudante da Trybe. Boas

Lucas Muffato 1 Dec 09, 2021
The Python agent for Apache SkyWalking

SkyWalking Python Agent SkyWalking-Python: The Python Agent for Apache SkyWalking, which provides the native tracing abilities for Python project. Sky

The Apache Software Foundation 149 Dec 12, 2022
python scripts and other files to generate induction encoder PCBs in Kicad

induction_encoder python scripts and other files to generate induction encoder PCBs in Kicad Targeting the Renesas IPS2200 encoder chips.

Taylor Alexander 8 Feb 16, 2022
Like Docker, but for Squeak. You know, for kids.

Squeaker Like Docker, but for Smalltalk images. You know, for kids. It's a small program that helps in automated derivation of configured Smalltalk im

Tony Garnock-Jones 14 Sep 11, 2022
Ked interpreter built with Lex, Yacc and Python

Ked Ked is the first programming language known to hail from The People's Republic of Cork. It was first discovered and partially described by Adam Ly

Eoin O'Brien 1 Feb 08, 2022
A pure-Python codified rant aspiring to a world where numbers and types can work together.

Copyright and other protections apply. Please see the accompanying LICENSE file for rights and restrictions governing use of this software. All rights

Matt Bogosian 28 Sep 04, 2022
万能通用对象池,可以池化任意自定义类型的对象。

pip install universal_object_pool 此包能够将一切任意类型的python对象池化,是万能池,适用范围远大于单一用途的mysql连接池 http连接池等。 框架使用对象池包,自带实现了4个对象池。可以直接开箱用这四个对象池,也可以作为例子学习对象池用法。

12 Dec 15, 2022
XHacks 2021 Startup Track Winner: Be Heard. Educate, Enact, Empower. No voice left behind. (backend)

Be Heard: X Hacks 2021 Submission Educate, Enact, Empower. No voice left behind. Inspiration To say 2020 was an eventful year would be an understateme

3 Jul 14, 2022
Make dbt docs and Apache Superset talk to one another

dbt-superset-lineage Make dbt docs and Apache Superset talk to one another Why do I need something like this? Odds are rather high that you use dbt to

Slido 81 Jan 06, 2023
This tool for beginner and help those people they gather information about Email Header Analysis, Instagram Information, Instagram Username Check, Ip Information, Phone Number Information, Port Scan

This tool for beginner and help those people they gather information about Email Header Analysis, Instagram Information, Instagram Username Check, Ip Information, Phone Number Information, Port Scan.

cb-kali 5 Feb 18, 2022