我使用滑翔V4.11负载图片来自网络,一切都做工精细在Android 5.0或更高,但在安卓4.X图片不加载。
这里是我的代码:
RequestOptions options = new RequestOptions()
.placeholder(android.R.drawable.progress_horizontal)
.error(android.R.drawable.presence_offline)
.diskCacheStrategy(DiskCacheStrategy.ALL);
Glide.with(context)
.load(data.getImage_url())
.apply(options)
.into(holder.thumbnail);
这里是在Android 4.4的logcat的:
W/Glide: Load failed for https://cdn.myanimelist.net/images/anime/3/67177.jpg with size [188x263]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 cause:
javax.net.ssl.SSLHandshakeException(javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb85422a0: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0xa744e990:0x00000000))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
There was 1 cause:
javax.net.ssl.SSLHandshakeException(javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb85422a0: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0xa744e990:0x00000000))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
There was 1 cause:
javax.net.ssl.SSLHandshakeException(javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb85422a0: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0xa744e990:0x00000000))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb85422a0: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0xa744e990:0x00000000)
我搜索了网络,我发现的是Android 4.4只支持TLS 1.0:https://support.globalsign.com/ssl/general-ssl/tls-protocol-compatibility
这可能是问题?如果是有什么办法呢?
谢谢。
这是一个握手例外。在设备比旧Android 5.0
TLSv1.1
和TLSv1.2
协议不是默认启用的,这就是为什么这发生异常。
你可以试试这个应用程序的类onCreate方法中:
if (Build.VERSION.SDK_INT == 19) {
try {
ProviderInstaller.installIfNeeded(this);
} catch (Exception ignored) {
}
}
此外,您可以检查这个问题的GitHub为更好的解决方案。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句