简体   繁体   English

java.security.cert.CertPathValidatorException:未找到证书路径的信任锚。 在 Glide 中加载图像时

[英]java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. while loading image in Glide

Image not loading with Glide, after migrated the server from HTTP to HTTPS.将服务器从 HTTP 迁移到 HTTPS 后,图像未使用 Glide 加载。 But the images are loaded in Browser correctly.但是图像在浏览器中正确加载。

Dependency:依赖:

implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

Simple image load:简单的图像加载:

Glide.with(Context).load(imageUrl).into(imgView);

How can I overcome this??我怎样才能克服这个??

i think the server hosting the file (backend server) is not trusted by REST client (Retrofit).我认为托管文件的服务器(后端服务器)不受 REST 客户端(改造)的信任。 Short term solution to continue development is to trust all certificates but for Production environment you will have to trust exact certificate of your backend (hosting images), this is usually done by either bundling certifcate file or its fingerprint.继续开发的短期解决方案是信任所有证书,但对于生产环境,您必须信任后端(托管图像)的确切证书,这通常通过捆绑证书文件或其指纹来完成。 Please refer here for sample implementations shared in other threads.请参阅此处以获取在其他线程中共享的示例实现。 Short term fix (for development) - https://stackoverflow.com/a/39032433/4741746 Similar thread - https://stackoverflow.com/a/41114813/1992013短期修复(用于开发) - https://stackoverflow.com/a/39032433/4741746类似线程 - https://stackoverflow.com/a/41114813/1992013

The issue is about certificate.问题是关于证书。 You need to create your custom GlideModule Class,OkHttpUrlLoader class and attach to you Glide as mention in the link below您需要创建您的自定义 GlideModule 类,OkHttpUrlLoader 类并附加到您的 Glide,如下面的链接中所述

https://futurestud.io/tutorials/glide-module-example-accepting-self-signed-https-certificates https://futurestud.io/tutorials/glide-module-example-accepting-self-signed-https-certificates

Then you have to put the following in your manifest file然后你必须把以下内容放在你的清单文件中

<meta-data
    android:name="io.futurestud.tutorials.glide.glidemodule.CustomImageSizeGlideModule"
    android:value="GlideModule" />

Check the example https://github.com/futurestudio/android-tutorials-glide/blob/master/app/src/main/AndroidManifest.xml检查示例https://github.com/futurestudio/android-tutorials-glide/blob/master/app/src/main/AndroidManifest.xml

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found Glide - javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:未找到认证路径的信任锚 - Glide - javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found java.security.cert.CertPathValidatorException:未找到证书路径的信任锚。 在api少24 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. on api less 24 java.security.cert.CertPathValidatorException:未找到证书路径的信任锚。 安卓 2.3 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. Android 2.3 java.security.cert.CertificateException:java.security.cert.CertPathValidatorException:未找到证书路径的信任锚 - java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found 如何解决“ javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。” - how to solve “javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.” Android Studio:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - Android Studio: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found Android N java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - Android N java.security.cert.CertPathValidatorException: Trust anchor for certification path not found Android-Retrofit2-java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - Android - Retrofit2 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM