Glide: Certain pictures not loading in Android 4.x

Created on 3 Jun 2018  路  12Comments  路  Source: bumptech/glide


Glide Version: 4.7.1


Integration libraries: glide:recyclerview-integration


Device/Android Version: Genymotion Emulator Nexus 5 Android 4.4.4


Issue details / Repro steps / Use case background:
I'm trying to load a set of pictures from the web, but in some cases (some pictures) do not load.


Demo Project


Stack trace / LogCat:

06-02 19:55:29.518 8618-8618/jahirfiquitiva.apps.frames.sample W/Glide: Load failed for https://github.com/jahirfiquitiva/Website-Resources/raw/master/wallpapers/thumbnails/unsplash_a.png with size [522x626]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There were 2 causes:
    javax.net.ssl.SSLHandshakeException(javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb806a8b0: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x96f70926:0x00000000))
    java.io.FileNotFoundException(No content provider: https://github.com/jahirfiquitiva/Website-Resources/raw/master/wallpapers/thumbnails/unsplash_a.png)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 2): 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=0xb806a8b0: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x96f70926: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=0xb806a8b0: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x96f70926: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=0xb806a8b0: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x96f70926:0x00000000)
      Cause (2 of 2): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.content.res.AssetFileDescriptor, LOCAL
    There was 1 cause:
    java.io.FileNotFoundException(No content provider: https://github.com/jahirfiquitiva/Website-Resources/raw/master/wallpapers/thumbnails/unsplash_a.png)
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 1): class java.io.FileNotFoundException: No content provider: https://github.com/jahirfiquitiva/Website-Resources/raw/master/wallpapers/thumbnails/unsplash_a.png
documentation stale

Most helpful comment

Hi guys,
From log it seems to be handshake exception. Android 4.4 and lower don't support certain protocols by themselves ( eg TLS 1.2 ), but Google made a workaround by bundling them inside play services.

Try the following code. We were getting similar exception for simply doing an http get request with okHttp and it helped, but for some reason it didn't work on < 4.4, so we decided to drop support for too old versions and support only 4.4+.

    if (Build.VERSION.SDK_INT == 19) {
        try {
            ProviderInstaller.installIfNeeded(this);
        } catch (Exception ignored) {
        }
    }

All 12 comments

Many users of my app are reporting the same problem on Android 4.x.
Glide version 4.7.1 and I'm not using recyclerview-integration.

I changed the URL to HTTP instead of HTTPS and the error is no longer happening.

Tested it with Picasso and the pictures also don't load with HTTPS and Android 4.x.
I think it's an Android 4.x bug.

@joseAugustoCR I already knew it was an issue with Android 4.x hence the title of the issue.

On devices older than Android 5.0 TLSv1.1 and TLSv1.2 protocols are not enabled by default and that's why this exception occurs.

[This answer] might be the way to solve it, but it should be done internally in Glide to provide proper backwards support to older Android versions.

Changing the url to http instead of https might not always work, because there are websites that redirect to the https one and it would fail again, I think

Hi guys,
From log it seems to be handshake exception. Android 4.4 and lower don't support certain protocols by themselves ( eg TLS 1.2 ), but Google made a workaround by bundling them inside play services.

Try the following code. We were getting similar exception for simply doing an http get request with okHttp and it helped, but for some reason it didn't work on < 4.4, so we decided to drop support for too old versions and support only 4.4+.

    if (Build.VERSION.SDK_INT == 19) {
        try {
            ProviderInstaller.installIfNeeded(this);
        } catch (Exception ignored) {
        }
    }

@q296789611 What if I don't want to use OkHttp in my project?

@jahirfiquitiva what else do you use?
Even Android uses okHttp for HttpURLConnection, but older and buggy version.

@jahirfiquitiva OKHttp is very well

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

@minas90
if (Build.VERSION.SDK_INT == 19) { try { ProviderInstaller.installIfNeeded(this); } catch (Exception ignored) { } }
Thanks, working for me!

@nvquangth I tried this code and still did not work. Where did you execute this code? Thanks!

@DSofter It can put in Application onCreate block.

Was this page helpful?
0 / 5 - 0 ratings