Glide 加载https报证书错误SSLHandshakeException Trust anchor for certification path not found

太叔睿
2023-12-01

1、报错信息

com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There was 1 cause:
    javax.net.ssl.SSLHandshakeException(java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.)
     call GlideException#logRootCauses(String) for more detail

2、解决方案

1、引入sdk

   implementation("com.github.bumptech.glide:okhttp3-integration:4.9.0") {
       exclude group: "com.android.support"
   }

2、在Application的onCreate里加入

 Glide.get(this).getRegistry().replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
 类似资料: