android – Glide – javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorExcept
作者:互联网
我将服务器从HTTP迁移到HTTPS我已经使用自签名证书来发送带有HttpUrlConnection的网络请求并且它工作但是对于图像加载它不起作用,因为我使用Glide进行图像加载.
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.while loading images from https URL through glide library
Glide.with(mContext).load(currentItem.getImage_path().replace(" ", "%20"))
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
genericViewHolder.imageView_1.setImageResource(R.drawable.image_thumbnail);
genericViewHolder.progressBar.setVisibility(View.GONE);
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
genericViewHolder.progressBar.setVisibility(View.GONE);
return false;
}
}).into(genericViewHolder.imageView_1);
我尝试使用this链接并使用GlideModule但它似乎不起作用.请帮忙.
解决方法:
问题是关于证书请按照此链接-https://stackoverflow.com/a/39032433/4741746
这将绕过证书并允许您进入系统
看到这个链接也是-https://futurestud.io/tutorials/glide-module-example-accepting-self-signed-https-certificates
创建您的自定义GlideModule类,OkHttpUrlLoader类并附上Glide,如上所述
你必须把
<meta-data
android:name="io.futurestud.tutorials.glide.glidemodule.CustomImageSizeGlideModule"
android:value="GlideModule" />
AndroidMainifiest文件https://github.com/fs-opensource/android-tutorials-glide/blob/master/app/src/main/AndroidManifest.xml的内部应用程序标记
标签:android-glide,android,ssl 来源: https://codeday.me/bug/20190928/1829784.html