Glide: Cannot load some URL (intermittent)

Created on 15 Jun 2017  ·  22Comments  ·  Source: bumptech/glide


Glide Version:4.0.0-RC0


Integration libraries:Failed on stock and OKHTTP integration, works on Picasso 2.5.2 and Glide 3.8.0


Device/Android Version:Sony Xperia J1 4.4.4


Issue details / Repro steps / Use case background:
Most URL works fine, but some URL fails to load intermittently, see error logs section.
Sample image url: https://lh3.googleusercontent.com/NSVbWbdKFGRzju5r5XsXKMJ9A41PVdWNhGSxDwxk9aO6o_7SeVMU8z27-GhdNw3uS0PZtLPts5tvaxdsHr--NRXZWfyi=s300


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

@GlideModule
public final class CustomGlideModule extends AppGlideModule {
}

            Glide.with(this)
                     .load("https://lh3.googleusercontent.com/NSVbWbdKFGRzju5r5XsXKMJ9A41PVdWNhGSxDwxk9aO6o_7SeVMU8z27-GhdNw3uS0PZtLPts5tvaxdsHr--NRXZWfyi=s300")
                     .placeholder(R.drawable.bg_image_default_light)
                     .into(holder.image);


Layout XML:

<RelativeLayout
            android:id="@+id/image_container"
            android:layout_width="match_parent"
            android:layout_height="@dimen/image_height"
            android:layout_alignParentStart="true"
            android:layout_below="@+id/ticket_header_container">

            <ImageView
                android:id="@+id/image"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                tools:src="@drawable/bg_image_default_light"/>

</FrameLayout>


Stack trace / LogCat:

06-15 16:34:28.638 15903-15903/com.anytimes.android.debug W/Glide: Load failed for https://storage.googleapis.com/static.anytimes.jp/images/categories/88-ok.jpg with size [318x188]
                                                                   class com.bumptech.glide.load.engine.GlideException: Failed to load resource
                                                                     Cause (1 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, DATA_DISK_CACHE, https://storage.googleapis.com/static.anytimes.jp/images/categories/88-ok.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 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, DATA_DISK_CACHE, https://storage.googleapis.com/static.anytimes.jp/images/categories/88-ok.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 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, DATA_DISK_CACHE, https://storage.googleapis.com/static.anytimes.jp/images/categories/88-ok.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}
                                                                     Cause (4 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{DirectByteBuffer->Object->Drawable}, REMOTE, https://storage.googleapis.com/static.anytimes.jp/images/categories/88-ok.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 (5 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{FileInputStream->Object->Drawable}, REMOTE, https://storage.googleapis.com/static.anytimes.jp/images/categories/88-ok.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 (6 of 6): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ParcelFileDescriptor->Object->Drawable}, REMOTE, https://storage.googleapis.com/static.anytimes.jp/images/categories/88-ok.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}
06-15 16:34:28.638 15903-15903/com.anytimes.android.debug E/Glide: class com.bumptech.glide.load.engine.GlideException: Failed to load resource
stale

Most helpful comment

it's working with me:
Glide.with(context)
.load(new URL(your_image))
.into(image)

All 22 comments

I have the same problem. If you have solved this problem, I hope you can help me

@lm11000 I had to disable all transition animations.

Same problem with different situation. When load from local server,ok, otherwise, failed.
Glide.with(context).load(url_local).into(iv) works, Glide.with(context).load(url_server).into(iv) failed.
v4.0.0-RC0

edit:
local_url: http://192.168.1.204:8888
remote_url: http://192.168.1.208:8888
proxy_url: http://api.some.com:80 => http://192.168.1.208:8888

(1) when use local_url(port:8888), App can load image correctly;
(2)when use remote_url(port:8888), App can not load image correctly;
(3)when use proxy_url(port:80),App can load image correctly.

I don't know why. Caused by port?

I had faced same issue, but was resolved when removed asGif().

it's working with me:
Glide.with(context)
.load(new URL(your_image))
.into(image)

Same issue here. Regarding the device, I am either able to download the image (nexus 5x) or not (galaxy s5). I am using Glide 4.1.1.
Any update on it ?

@tvhieuit that also worked for me! Thank you very much!
Previously I used url as string, not as URL object

@tvhieuit Thank you, use your approach to solve my problem, but why should this be done?

@tvhieuit thank you ! that was helpful

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.

I'm not sure what using new URL would fix. Using new URL() on the main thread will introduce performance problems and isn't generally recommended.

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.

//Im try in activity screen it work also

compile 'com.github.bumptech.glide:glide:4.2.0'

Glide.with(this)
    .load("https://png.pngtree.com/element_origin_min_pic/17/01/04/15d80cc97cadf95f17258bc849b67b36.jpg")
        .disallowHardwareConfig()
    .into(ivTryGlide)

In my case,my url string has lots of redundant space.Just use trim() method to delete them will work.

It happened on some phones with 8.1 system.

I setup this to solve the issue.

Glide.with(this)
.load(url)
.disallowHardwareConfig()
.into(iv)

Hope to help more

我的情况是第一次安装打开app的时候没有问题 第二次修改图片有就有问题了

Somehow @tvhieuit 's solution works for me.

Glide v 4.9.0 load pictures no display ?

example

Glide.with(context).load(url).into(imageView);

Removing DrawableTransitionOptions worked for me.

Though my path is correct and I am able to open the image, I couldn't load it using a string. I had to use URL and the below worked:
Glide.with(context)
.load(new URL(path))
.into(imageView)

but load(URL url) is deprecated so using Uri instead worked:
it's working with me:
Glide.with(context)
.load(Uri.Parse(path))
.into(imageView)

我的情况是第一次安装打开app的时候没有问题第二次修改图片有就有问题了
老哥你问题咋解决的

emm... Just uninstall the program and run it again and I'm done. I think the AVD just didn't react.

Was this page helpful?
0 / 5 - 0 ratings