Skip to content Skip to sidebar Skip to footer

Proguard Error After Adding Glide V4

I am not able to generate the apk with proguard enabled after adding glide v4 library. I have added the below lines in proguard-rules -keep public class * implements com.bumptech.g

Solution 1:

It's save to ignore these warning using:

-dontwarn com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool-dontwarn com.bumptech.glide.load.resource.bitmap.Downsampler-dontwarn com.bumptech.glide.load.resource.bitmap.HardwareConfigState

See this post

Solution 2:

Proguard

If you use proguard, you may need to add the following lines to your proguard.cfg:

-keep publicclass * implements com.bumptech.glide.module.GlideModule
-keep publicclass * extends com.bumptech.glide.module.AppGlideModule
-keep publicenumcom.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

If you're targeting any API level less than Android API 27, also include:

-dontwarn com.bumptech.glide.load.resource.bitmap.VideoDecoder

VideoDecoder uses API 27 APIs which may cause proguard warnings even though the newer APIs won’t be called on devices with older versions of Android.

Solution 3:

I assume you take your proguard rules from this glide page but it is miswritten. Replace below line

-keep public class * extends com.bumptech.glide.AppGlideModule

with this:

-keep public class * extends com.bumptech.glide.module.AppGlideModule

as you see, module package is missing. It is also properly documented on README page. You can also check your AppGlideModule class path from External Libraries.

Solution 4:

You can as well increase your compileSdkVersion to 26. This takes care of the new features that Glide v4 uses.

Post a Comment for "Proguard Error After Adding Glide V4"