Skip to main content

[![Build Status](https://travis-ci.org/KeepSafe/android-resource-remover.svg?branch=master)](https://travis-ci.org/KeepSafe/android-resource-remover)

![resource-remover](https://keepsafe.github.io/i/proj/opensource_resource-remover.png) android-resource-remover ========================

android-resource-remover is utility that removes unused resources reported by [Android Lint](http://developer.android.com/tools/help/lint.html) from your project. The goal is to reduce your APK size and keep the app clean from unused stuff.

## Getting started Requirements:

  • Python >= 2.7.*

  • ADT >= 16

To install run:

pip install android-resource-remover

## Usage - general Open the directory where your app is located and run

` android-resource-remover `

Android resources have dependencies to each other. This means that after running resource-remover the first time, it will clean up unused resources file that hold a reference to other resources. You can run this resource remover multiple times until there is no more unused resources to be removed. We’ve been running it up to 4 times in a row.

### Use with gradle android-resource-remover is build on top of android lint. If you have a gradle project you have to run lint within your gradle build scripts and then use the lint-result.xml as the input file for android-resource-remover

e.g.

./gradlew clean build :lint && android-resource-remover –xml build/outputs/lint-results.xml

### Options

#### –help Prints help message.

#### –lint Full path to the lint tool like: d:DevAndroid SDKtoolslint

This will be executed as the lint command. If not provided it assumes the lint command in available and runs: lint

#### –app Full path to the android app like: d:DevMy_Android_App

If not provided it assumes the current directory is the app’s root directory.

#### –xml

Use existing lint result. If provided lint won’t be run.

#### –ignore-layouts

Ignore layout directory

## Expected behavior ### Resource ID in code not found

If you have references to elements in an old layout that you’re not using anymore, you will get a compile error that the ID (R.id.<something>) can not be found. The reason is that the resource file that contained R.id.<something> has been removed as it was not used any more. Time to clean up your code.

## FAQ

Q: installing dependency lxml failed with clang: error: unknown argument: ‘-mno-fused-madd’ [-Wunused-command-line-argument-hard-error-in-future] A: [http://stackoverflow.com/a/22322645](http://stackoverflow.com/a/22322645)

Q: installing dependency lxml failed with fatal error: ‘libxml/xmlversion.h’ file not found A: There are several ways to fix this listed on stackoverflow [http://stackoverflow.com/questions/19548011/cannot-install-lxml-on-mac-os-x-10-9](http://stackoverflow.com/questions/19548011/cannot-install-lxml-on-mac-os-x-10-9)

## Issues and PR

When opening an issue please include as much info as possible. pip.log, python varsion/info, os version/info might all be help us understanding what’s the problem.

In PR please keep the formatting.

## Licence Apache version 2.0

CHANGES

0.1.7 (2016-06-20)

  • Bugfixes.

0.1.6 (2016-04-09)

  • Bugfixes.

0.1.5 (2015-07-27)

  • Check if the file exists before removing values.

0.1.4 (2015-05-21)

  • Includes data files for pip.

0.1.3 (2015-03-31)

  • Executes subprocess in a safe way.

0.1.2 (2015-03-25)

  • Fixes #9. Supports new missing resource message pattern.

0.1.1 (2014-09-11)

  • Fixes #5. Checks if the file exists before trying to remove it.

0.1.0 (2014-02-14)

  • Initial release.

Metadata

Release files for android-resource-remover 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for android-resource-remover 0.1.7
File Size Uploaded Provenance Actions
android-resource-remover-0.1.7.tar.gz 10.9 kB Without provenance Details for android-resource-remover-0.1.7.tar.gz

Release files / android-resource-remover-0.1.7.tar.gz

Download URL android-resource-remover-0.1.7.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ba6e5306ff81c19e73b2b34e74477e5f5d60c932ec3200297bdf8081a0df3df6
BLAKE2b-256 checksum
How to use checksums
e104e9e0eb7da5d963e8229685603dbc723ae0ffcc5bb37e5ed8683800882778
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for android-resource-remover 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page