Estoy usando Glide v4.11 para visualizar fotos desde la web, bien todo el trabajo en Android 5.0 o superior, pero en android 4.X imágenes no se cargan.
Aquí está mi código:
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);
y aquí está la LogCat en Android 4.4:
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)
He buscado sobre web y me encontré con que Android 4.4 sólo se admite TLS 1.0: https://support.globalsign.com/ssl/general-ssl/tls-protocol-compatibility
Que puede ser el problema? y si es así ¿hay alguna solución?
Gracias.
Es una excepción apretón de manos. En los dispositivos mayores de Android 5.0
TLSv1.1
y TLSv1.2
protocolos no están habilitadas por defecto y por eso se produce esta excepción.
Puede probar este método en el interior onCreate la clase de su aplicación:
if (Build.VERSION.SDK_INT == 19) {
try {
ProviderInstaller.installIfNeeded(this);
} catch (Exception ignored) {
}
}
También, se puede comprobar este problema github de mejores soluciones.