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

Can't load net url in version 4.5.0. #2824

Closed
tysheng opened this issue Jan 19, 2018 · 10 comments
Closed

Can't load net url in version 4.5.0. #2824

tysheng opened this issue Jan 19, 2018 · 10 comments
Labels

Comments

@tysheng
Copy link

tysheng commented Jan 19, 2018

Original GlideVersion: 4.2.0
Device: Redmi Note 3
Android Version: 7.1.2
Network: Wifi

When I update to 4.5.0, I can't load image from net url.
Here is the error message

E/GlideExecutor: Request threw uncaught throwable
                                                                         java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
                                                                             at java.util.ArrayList.get(ArrayList.java:411)
                                                                             at java.util.Collections$UnmodifiableList.get(Collections.java:1295)
                                                                             at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:58)
                                                                             at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:299)
                                                                             at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:266)
                                                                             at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:230)
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                             at java.lang.Thread.run(Thread.java:761)
                                                                             at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)

Then I changed to 4.4.0, it worked. So is there something changed in 4.5.0?

@sjudd
Copy link
Collaborator

sjudd commented Jan 19, 2018

Please fill out the issue template when filing new issues. In particular you're missing your Glide load line.

What url are you using to reproduce this? Consider sending a pull request with a failing test case.

@tysheng
Copy link
Author

tysheng commented Jan 20, 2018

I tried many urls, it worked in 4.4.0, but not in 4.5.0.
Just normal use,

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

@sjudd
Copy link
Collaborator

sjudd commented Jan 21, 2018

Could you provide a specific example of one url that doesn't work?

@tysheng
Copy link
Author

tysheng commented Jan 23, 2018

@sjudd
Copy link
Collaborator

sjudd commented Jan 23, 2018

Glide.with(activity).load("https://www.w3schools.com/howto/img_fjords.jpg").into(imageView) works fine in Glide's sample app on 4.5.0.

Consider attaching a failing test case or a sample app.

@OsBelief
Copy link

I have the same problem.

Glide Version: 4.5.0
Device: Lenovo A2010-a
Android Version: 5.1
Network: Wifi
Url: http://cdn7.ushareit.cn/sz2/i/171228/1q8_w447_h365_s40089.jpeg

First, I use Glide.with(context).load(url) works fine, then when I use Glide.with(context).asFile().load(url).submit().get() to load from cache, the above problem happened.

@kekeng
Copy link

kekeng commented Jan 30, 2018

@sjudd if you do asFile like Glide.with(activity).asFile().load("https://www.w3schools.com/howto/img_fjords.jpg").submit() first, and then do Glide.with(activity).load("https://www.w3schools.com/howto/img_fjords.jpg").into(imageView), you will find the issue

@sjudd
Copy link
Collaborator

sjudd commented Jan 30, 2018

Thanks @kekeng, I'm able to reproduce with just Glide.with(activity).asFile().load("https://www.w3schools.com/howto/img_fjords.jpg").submit().

As a workaround when using asFile(), you can also apply DiskCacheStrategy.DATA. I don't believe anything new is broken in 4.5, but let me know if you think this changed from 4.4 to 4.5.

@tysheng
Copy link
Author

tysheng commented Jan 31, 2018

Thanks @kekeng @sjudd , I think it's the reason of my issue.

@tysheng
Copy link
Author

tysheng commented Jan 31, 2018

 File file = Glide.with(context)
                                .downloadOnly()
                                .load(url)
                                .submit()
                                .get();

it's the better way to get file

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

4 participants