GithubHelp home page GithubHelp logo

barayuda / android-resource-remover Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keepsafe/android-resource-remover

0.0 2.0 0.0 136 KB

A simple utility to remove unused resources in your Android app to lower the size of the APK. It's based on the Android lint tool output.

License: Apache License 2.0

Python 70.65% Makefile 15.19% Java 14.16%

android-resource-remover's Introduction

Build Status

android-resource-remover

android-resource-remover is utility that removes unused resources reported by Android Lint 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:\Dev\Android SDK\tools\lint

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:\Dev\My_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

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.

Release History

  • 2015-03-31   v0.1.3   Fixes bugs
  • 2015-03-25   v0.1.2   Fixes bugs
  • 2014-09-11   v0.1.1   Fixes bugs
  • 2014-02-14   v0.1.0   Initial release

Licence

Apache version 2.0

android-resource-remover's People

Contributors

ca77y avatar fafhrd91 avatar gitter-badger avatar mrmaffen avatar philippb avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.