Search code examples
javaandroidproguard

android-support-v4 remove unused classes


Bacially, I am trying to shrink my application's .apk down to the smallest size possible. I currently have android-support-v4 jar file imported. My question is this: how do I remove unused classes from this jar file?

Not finding any information after quite a bit of searches. If ProGuard is the solution, text to include in my proguard-project.txt file would be appreciated.


Solution

  • ProGuard indeed shrinks the size of applications. It treats application code (src/...) and library code (libs/..., library projects) the same, so you don't need to change the structure of your project. It is especially useful if you are using small parts of large libraries, since it removes the unused parts.

    The Android developer guide explains how you can enable ProGuard for release builds. If your application doesn't perform any reflection, the default configuration (with an empty proguard-project.txt) should be sufficient.