Glide: Is pro-guard necessary to use with Glide

Created on 30 Jan 2017  路  4Comments  路  Source: bumptech/glide


Glide Version: 3.7.0


Integration libraries: Volley


Device/Android Version:


Issue details / Repro steps / Use case background: I have seen a review where it's said that using pro-guard is highly recommended with Glide because of the large number of methods used.

My question is, if I don't use pro-guard, will it slow down my App significantly? I didn't observe a lot of change myself in my Android 4.4.2 device.

By the way, I tried to use proguard, but resulted lots of errors (almost certainly due to bad rules), so don't wan't to take the hassle unless necessary.

non-library question

Most helpful comment

No, it's not required, though I highly recommend spending a little time on it, because it gives your users a much smaller APK download size. I've had the "pleasure" of using a phone released at the end of 2016 which has the same characteristics of a high-end phone from 2011: it's horrible when you need to delete an app to update another one, because they're huge (see Uber for example). There shouldn't be much performance improvement though unless you have a lot of algorithms in your code, most of the time you're calling the Android system classes, which cannot be shrinked because they exist on the device.

All 4 comments

No, it's not required, though I highly recommend spending a little time on it, because it gives your users a much smaller APK download size. I've had the "pleasure" of using a phone released at the end of 2016 which has the same characteristics of a high-end phone from 2011: it's horrible when you need to delete an app to update another one, because they're huge (see Uber for example). There shouldn't be much performance improvement though unless you have a lot of algorithms in your code, most of the time you're calling the Android system classes, which cannot be shrinked because they exist on the device.

Right, thanks a lot for great support as always :).

I am not sure if I should ask it here. If I use pro-guard as you advised, should I exclude glide library using following rule (found in a Git repo)?

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
}

Yes, that's the suggested for Glide. Actually, this still allows all Glide to be optimized away (correctly), it only keeps the integrations. That second ImageHeaderParser rule may not even be needed, we only have anecdotal evidence that it's required.

Was this page helpful?
0 / 5 - 0 ratings