Skip to content Skip to sidebar Skip to footer

Generated .apk Includes Unused Resources And Unused Classes

I am developing a very simple application for Android, which literally all it does is display the current time and date on the screen. With this in mind I was expecting the app to

Solution 1:

I never used nor included any of them

If you have dependencies, those classes and resources came from them.

Is it possible to somehow avoid these unused resource files and classes from being included in the release of the .apk?

Eliminate your dependencies.

For example, when you created the project, you may have been presented with a "Backwards Compatibility (AppCompat)" checkbox, pre-checked. Leaving that checked adds a dependency on appcompat-v7 and sets up your project to use it (e.g., your activity extends AppCompatActivity instead of Activity). There are pros and cons for using appcompat-v7; one of the cons is that it adds a fair bit of overhead to your project.

Post a Comment for "Generated .apk Includes Unused Resources And Unused Classes"