1

I've seen that's possible to detect unused resources (especially media resources which take some space) here android-remove-unused-resources-before-shipping and here remove-all-unused-resources-from-an-android-project.

I was wondering if we can use these tools in a ant build file in order to ignore them when building a release package?

I'm using eclipse with the latest version of ADT and ant to build.

Thank you :)

Community
  • 1
  • 1
Leoz
  • 733
  • 1
  • 7
  • 10

4 Answers4

2

To remove unused resources you can use Android Lint tool from ADT 16. It will help you not only to remove unused resources, but also to find potential bugs.

http://tools.android.com/tips/lint

You can also enable proguard in release mode

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer.

http://developer.android.com/tools/help/proguard.html

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • +! ... an offtopic querry .. doesn't eclipse use proguard by deffault? in normal building doesnt it optimize the resource?? – stinepike Apr 19 '13 at 08:11
  • 2
    Ok but does proguard remove unused resources like images from drawable-* ? For Lint tool I know it can helps me to find unused resources but the thing is I want to keep these resources in my project but not in my release apk. That's why I search a way to automatize this at the release build time. – Leoz Apr 19 '13 at 08:25
  • 1
    @StinePike you need to enable proguard in project properties file. When you export your apk as a singned apk it will obfuscate and packages the same to .apk. – Raghunandan Apr 19 '13 at 08:29
  • @Leoz check the link http://proguard.sourceforge.net/index.html#manual/examples.html – Raghunandan Apr 19 '13 at 08:30
  • @Leoz you can enable proguard in release mode. You can unzip the .apk and check yourself – Raghunandan Apr 19 '13 at 08:33
0

In Eclipse, you can use Lint. It is in the ADT package

Pauland
  • 1,974
  • 16
  • 25
0

Click your project on Project Explorer > Android Tools > Run Lint > Watch the Lint Tab.

You can see so many issues on Lint tab. And, Check the line like below...

enter image description here

Clear all the files or any resources.

cmcromance
  • 2,289
  • 1
  • 25
  • 26
0

If you like program in Linux, so bash - it's your all.
But for windows or mac there are not cool tools such bash. That's why you can write special program for removing unused resources which use android sdk tool - Lint
You can try my programm

xoxol_89
  • 1,242
  • 11
  • 17