0
对不起,我的英语。我需要从url加载图片,但url使用HTTPS协议。我试图通过Android的libruary ImageLoader负荷的形象和我有错误:HTTPS加载图像(android)
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
我怎样才能在协议HTTPS加载图像?
我的例子:
在主要活动:
DisplayImageOptions mDisplayImageOptions = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.abc_ab_share_pack_mtrl_alpha)
/*.showImageOnLoading(R.drawable.loading_bg)
.showImageOnLoading(R.drawable.loading_bg)*/
.cacheInMemory(true)
.cacheOnDisc(true)
.build();
ImageLoaderConfiguration conf = new ImageLoaderConfiguration.Builder(context)
.defaultDisplayImageOptions(mDisplayImageOptions)
.memoryCacheSize(50 * 1024 * 1024)
.discCacheSize(50 * 1024 * 1024)
.denyCacheImageMultipleSizesInMemory()
.diskCacheExtraOptions(250, 250, null)
.threadPoolSize(5)
.writeDebugLogs()
.build();
mImageLoader = ImageLoader.getInstance();
mImageLoader.init(conf);
而且在适配器
imageLoader.displayImage(image.get(position).getLinkImge(),holder.image);
**服务器的SSL证书不是由受信任的机构签署的**。您需要服务器的* valid *证书或为自定义图像下载类实现自定义SSLSocketFactory,如果满足某些条件,将绕过证书检查。 –
你使用自签名证书吗? – Panther
检查了这一点,如果它可以帮助你的问题 http://stackoverflow.com/questions/21183043/sslhandshakeexception-trust-anchor-for-certification-path-not-found-android-http – Panther