How to remove unused resources from libraries?

At first I know Delete all unused resources from the android project , but this is only for projects.

I want to delete unused images from a library, for example, Google Play Services or Wearable SDK. I already know that I can remove unwanted languages ​​in gradle using resConfigs , but I don't know how to remove images and layouts that I don't use. Is there any way to avoid adding them?

+6
source share
2 answers

I almost skipped this to write that there is now a good solution:

 android { buildTypes { release { minifyEnabled true shrinkResources true } } } 

This was disabled on Google+ by Tor Norbye for build tools version 0.14.0

+5
source

Probably all you need to know about this is in this very good article by Cyril Mottier: http://cyrilmottier.com/2014/08/26/putting-your-apks-on-diet/

Read the Lint part (“Use Lint Extensively”) as it is a tool that allows you to remove unused resources.

Hope this helps ...

+1
source

Source: https://habr.com/ru/post/975278/


All Articles