在生产版本上加载图像时,GLIDE产生奇怪的错误 [英] Strange error with GLIDE while loading image on production build

查看:838
本文介绍了在生产版本上加载图像时,GLIDE产生奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的生产应用程序上应用ProGuard之后.从网址加载图片时,我们面临以下错误

After applying ProGuard on my production app. We are facing the following error on loading images from URLs

E/vw: Glide failed to load image with exception: UNABLE TO LOAD PUBLICSUFFIXES.GZ RESOURCE FROM THE CLASSPATH.

java.lang.IllegalStateException: Unable to load publicsuffixes.gz resource from the classpath.

最后,我们尝试使用以下命令将整个Glide源保持在progaurd配置中

Finally, we tried keeping the whole Glide sources in the progaurd configuration with the following command

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

但仍然面临着同样的问题.

But still facing the same issue.

不确定要如何解决上述错误.

Not sure what exactly should be done to fix the error above.

我们还尝试通过执行以下操作来保持错误中提到的确切路径:

We also tried keeping the exact path as mentioned in the error by doing the following:

-keep class okhttp3.internal.publicsuffix.PublicSuffixDatabase
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

我确实在Github问题和其他论坛上尝试了各种推荐的解决方案,但都无济于事.

I did try various recommended solutions on the Github issues and other forums but none of them helped.

推荐答案

在您的应用gradle文件中使用它,它将解决此问题.

use this in your app gradle file and it will solve the problem.

android {
    defaultConfig {
        multiDexEnabled true
    }
    packagingOptions {
        pickFirst  'META-INF/*'
        exclude "okhttp3/internal/publicsuffix/publicsuffixes.gz"
    }
}

这篇关于在生产版本上加载图像时,GLIDE产生奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆