zoukankan      html  css  js  c++  java
  • 问题解决-使用Glide出现资源加载异常

    项目报错,处理步骤如下:

       1>使用glide中的资源加载监听器(Listener),抓取Log

                  

      listener(new RequestListener<String, GlideDrawable>() {
       @Override
       public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
       Log.d(TAG,"onException:e="+e.toString()+";target:"+target+";isFirstResource="+isFirstResource);
       Toast.makeText(getApplicationContext(),"资源加载异常",Toast.LENGTH_SHORT).show();
       return false;
       }

       @Override
       public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
       Log.e(TAG, "isFromMemoryCache:"+isFromMemoryCache+" model:"+model+" isFirstResource: "+isFirstResource);
       Toast.makeText(getApplicationContext(),"图片加载完成",Toast.LENGTH_SHORT).show();
       return false;
       }
      })

              2>Log如下:

         javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException:

               Could not validate certificate:

         Certificate not valid until Wed Nov 06 05:36:50 GMT+08:00 2013 (compared to Mon Nov 23 10:29:45 GMT+08:00 1970)

    结论:从上面的Log可以看出这个图片使用的是https协议(SSL协议,是一种安全传输协议),然后出现了这个问题。这个异常是说在校验证书的时候出现时间校验的失败!

              打开手机看一下时间是1970年时间,调整时间即可正常下载。

    有几位大牛提供了解决方案:

    http://my.oschina.net/blackylin/blog/144136

    http://www.eoeandroid.com/thread-161747-1-1.html

    然后还有一篇关于https协议的好博文:

    http://www.cnblogs.com/P_Chou/archive/2010/12/27/https-ssl-certification.html

  • 相关阅读:
    freopen
    字符
    map映射
    P3512 [POI2010]PIL-Pilots-洛谷luogu
    快读
    单调队列&单调栈
    简写
    邻接表&链式前向星
    mysql参数详解
    网络管理指南
  • 原文地址:https://www.cnblogs.com/zly1022/p/7865607.html
Copyright © 2011-2022 走看看