I have some library modules in my application and there are a lot of resources that are unused. But they did not remove in release build.
minifyEnabled has been set true in release buildType and also shrinkResources has set true in app
module.
Note: Proguard worked correctly and remove all of the unused source codes.(including library module source codes).
P.S: I know that we can't use shrinkResources option in library modules and this shrinking is app
module responsibility.
UPDATE1 : I read this thread's answers. Although I didn't use getIdentifier()
, it hasn't effect.
UPDATE2: According to below quote, I checked R
class in output apk and I found references(id
) to unused resources. Why are they there?
Proguard works on the Java side. Unfortunately, it doesn’t work on the resources side. As a consequence, if an image my_image in res/drawable is not used, Proguard only strips it’s reference in the R class but keeps the associated image in place. source