Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glide won't load certain images #2132

Closed
azurh opened this issue Jul 12, 2017 · 6 comments
Closed

Glide won't load certain images #2132

azurh opened this issue Jul 12, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@azurh
Copy link

azurh commented Jul 12, 2017

Glide Version: 4.0.0-RC1 (also tried 3.7.0 and 3.8.0)

Integration libraries: No

Device/Android Version: Nexus 5 (6.0.1), Galaxy S5 (6.0.1), Galaxy S4 (5.0.1) and other Galaxy phones.

Issue details / Repro steps / Use case background:

  • Expected behavior: The image should load
  • Actual behavior: The image doesn't load

Glide load line / GlideModule (if any) / list Adapter code (if any):

GlideApp.with(this).
load("https://od.lk/s/121195309_xa4Rd/Cover.jpg").
listener(new RequestListener<Drawable>() {
	@Override
	public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target,
		boolean isFirstResource) {
		if (e != null) {
			Log.d("glideexeception", e.getMessage());
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target,
		DataSource dataSource, boolean isFirstResource) {
		return false;
	}
}).
into(mTestImg);

However, this image (https://od.lk/s/121195309_xa4Rd/Cover.jpg) works perfectly in Picasso with this one-liner:

 Picasso.with(this).
   load("https://od.lk/s/121195309_xa4Rd/Cover.jpg").
   into(mTestImg);

So I think that this is a Glide issue.

Here are some other image files which Glide fails to load:

Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent">

	<ImageView
		android:id="@+id/testimg"
		android:layout_width="match_parent"
		android:layout_height="match_parent" />

</FrameLayout>

Stack trace / LogCat:

07-12 13:35:35.556 31296-31296/? I/art: Late-enabling -Xcheck:jni
07-12 13:35:35.575 31296-31302/? I/art: Debugger is no longer active
07-12 13:35:35.598 31296-31296/? W/System: ClassLoader referenced unknown path: /data/app/com.yenks.glidenewtimeout-2/lib/arm
07-12 13:35:35.623 31296-31296/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-12 13:35:35.695 31296-31321/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
07-12 13:35:35.725 31296-31321/? I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
07-12 13:35:35.726 31296-31321/? I/OpenGLRenderer: Initialized EGL, version 1.4
07-12 13:35:39.223 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.223 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.223 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.223 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.226 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.226 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.226 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.226 31296-31371/com.yenks.glidenewtimeout D/skia: --- SkImageDecoder::Factory returned null
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/Glide: Load failed for https://od.lk/s/121195309_xa4Rd/Cover.jpg with size [1080x1536]
      class com.bumptech.glide.load.engine.GlideException: Failed to load resource
        Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, REMOTE, https://od.lk/s/121195309_xa4Rd/Cover.jpg
          Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}
          Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->Bitmap->Drawable}
          Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->BitmapDrawable->Drawable}
        Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, REMOTE, https://od.lk/s/121195309_xa4Rd/Cover.jpg
          Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->Drawable}
          Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->Bitmap->Drawable}
          Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
        Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, REMOTE, https://od.lk/s/121195309_xa4Rd/Cover.jpg
          Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->Bitmap->Drawable}
          Cause (2 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->BitmapDrawable->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout E/Glide: class com.bumptech.glide.load.engine.GlideException: Failed to load resource
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout D/glideexeception: Failed to load resource
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err: class com.bumptech.glide.load.engine.GlideException: Failed to load resource
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:   Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, REMOTE, https://od.lk/s/121195309_xa4Rd/Cover.jpg
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->Bitmap->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->BitmapDrawable->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:   Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, REMOTE, https://od.lk/s/121195309_xa4Rd/Cover.jpg
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->Bitmap->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->BitmapDrawable->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:   Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, REMOTE, https://od.lk/s/121195309_xa4Rd/Cover.jpg
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->Bitmap->Drawable}
07-12 13:35:39.273 31296-31296/com.yenks.glidenewtimeout W/System.err:     Cause (2 of 2): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ParcelFileDescriptor->BitmapDrawable->Drawable}
@azurh azurh changed the title Glide won't load a simple image Glide won't load a certain images Jul 12, 2017
@azurh azurh changed the title Glide won't load a certain images Glide won't load certain images Jul 12, 2017
@sjudd sjudd added this to the 4.0 milestone Jul 13, 2017
@Incineroar
Copy link

Incineroar commented Jul 14, 2017

I was just working on integrating this library into my in-development app for a website, and it appears I'm having the same issues as well, using 4.0.0 RC1.

Link to image: https://www.pokecommunity.com/customavatars/avatar150187_74.gif

logcat:

07-13 22:55:57.145 13231-13231/com.jvk.android.pcnotifier W/Glide: Load failed for https://www.pokecommunity.com/customavatars/avatar150187_74.gif with size [551x248]
                                                                   class com.bumptech.glide.load.engine.GlideException: Failed to load resource
                                                                     Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->GifDrawable->GifDrawable}, DATA_DISK_CACHE, https://www.pokecommunity.com/customavatars/avatar150187_74.gif
                                                                       Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->GifDrawable}
                                                                     Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->GifDrawable->GifDrawable}, DATA_DISK_CACHE, https://www.pokecommunity.com/customavatars/avatar150187_74.gif
                                                                       Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->GifDrawable}
                                                                     Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->GifDrawable->GifDrawable}, REMOTE, https://www.pokecommunity.com/customavatars/avatar150187_74.gif
                                                                       Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->GifDrawable}
                                                                     Cause (4 of 4): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->GifDrawable->GifDrawable}, REMOTE, https://www.pokecommunity.com/customavatars/avatar150187_74.gif
                                                                       Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{FileInputStream->GifDrawable->GifDrawable}
07-13 22:55:57.145 13231-13231/com.jvk.android.pcnotifier E/Glide: class com.bumptech.glide.load.engine.GlideException: Failed to load resource

Code being used to load the image:

ImageView iv = (ImageView) headerLayout.findViewById(R.id.imageViewAvatar);
        RequestOptions ro = new RequestOptions()
                .fitCenter()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .placeholder(R.drawable.icon_color3)
                .override(256, 140)
                .fitCenter();

        if (!sharedPrefs.getString("myAvatarURL", "").equals("")) {
            //we have an avatar revision, use a url stringbuilder to get the avatar, download it, and set it to the drawer icon.
            String imageURL = sharedPrefs.getString("myAvatarURL", "");
            Glide.with(getApplicationContext()).asGif().load(imageURL).apply(ro).into(iv);
        }
        else
        {
            Glide.with(getApplicationContext()).load(R.drawable.icon_color3).apply(ro).into(iv); //default load the PC icon as the user's avatar.
        }

@sjudd
Copy link
Collaborator

sjudd commented Jul 14, 2017

For https://od.lk/s/119127432_OQkeb/tumblr_of4zhq2tW71r2qr2so1_500.jpg this occurs because we're passing in an Accept-Encoding header of 'identity' and getting back an encoding of 'deflate'.

I think that's a bug in the backend serving that url. It's probably something we can handle locally as well. The Android documentation for HttpUrlConnection seems incorrect in that if we don't pass in that header (on API 25 at least), we still get back valid content lengths: https://developer.android.com/reference/java/net/HttpURLConnection.html.

@sjudd sjudd self-assigned this Jul 14, 2017
@sjudd sjudd closed this as completed in a61d751 Jul 14, 2017
@Incineroar
Copy link

I hate replying to a closed issue, but I tried the 20170714 snapshot to see if this issue would be rectified, however, I'm still getting the same errors. In addition, using Picasso's into function, the same image URL works perfectly fine in the ImageView.

@sjudd
Copy link
Collaborator

sjudd commented Aug 1, 2017

@Incineroar Can you open a new issue with whatever urls and errors you're seeing?

@geniushkg
Copy link

@sjudd ,@Incineroar , @azurh
I faced similar issue , but was resolved when i removed asGif().

@liufsd
Copy link

liufsd commented Sep 8, 2017

@geniushkg yes ,"but was resolved when i removed asGif()." i find this.
why ?

https://f1gr.hjfile.cn/pic/20170906/201709060335318628.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants