android Glide 4.8.0 报错java.lang.IndexOutOfBoundsException(Invalid index 0, size is 0)

java.lang.IndexOutOfBoundsException(Invalid index 0, size is 0)
                                                                                            call GlideException#logRootCauses(String) for more detail
详细信息:

 java.lang.IndexOutOfBoundsException(Invalid index 0, size is 0)
                                                                                            call GlideException#logRootCauses(String) for more detail
07-16 10:28:31.156 3343-3343/com.maiboparking.zhangxing.client.user.xianparking W/Glide: Load failed for http://dev-cub.changantingche.com/v4.0/picture/query/66f1ec66f53e46e2b676859d52398017 with size [879x1125]
                                                                                         class com.bumptech.glide.load.engine.GlideException: Failed to load resource
                                                                                         There was 1 cause:
                                                                                         java.lang.IndexOutOfBoundsException(Invalid index 0, size is 0)
                                                                                          call GlideException#logRootCauses(String) for more detail
                                                                                           Cause (1 of 1): class java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
07-16 10:28:31.156 3343-3343/com.maiboparking.zhangxing.client.user.xianparking I/Glide: Root cause (1 of 1)
                                                                                         java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
                                                                                             at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
                                                                                             at java.util.ArrayList.get(ArrayList.java:308)
                                                                                             at java.util.Collections$UnmodifiableList.get(Collections.java:1050)
                                                                                             at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:71)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:269)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
                                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                             at java.lang.Thread.run(Thread.java:818)
                                                                                             at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
07-16 10:28:31.157 3343-3343/com.maiboparking.zhangxing.client.user.xianparking W/Glide: Load failed for http://dev-cub.changantingche.com/v4.0/picture/query/66f1ec66f53e46e2b676859d52398017 with size [879x1125]
                                                                                         class com.bumptech.glide.load.engine.GlideException: Failed to load resource
                                                                                         There was 1 cause:
                                                                                         java.lang.IndexOutOfBoundsException(Invalid index 0, size is 0)
                                                                                          call GlideException#logRootCauses(String) for more detail
                                                                                           Cause (1 of 1): class java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
07-16 10:28:31.158 3343-3343/com.maiboparking.zhangxing.client.user.xianparking I/Glide: Root cause (1 of 1)
                                                                                         java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
                                                                                             at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
                                                                                             at java.util.ArrayList.get(ArrayList.java:308)
                                                                                             at java.util.Collections$UnmodifiableList.get(Collections.java:1050)
                                                                                             at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:71)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:269)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
                                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                             at java.lang.Thread.run(Thread.java:818)
                                                                                             at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
07-16 10:28:31.158 3343-3343/com.maiboparking.zhangxing.client.user.xianparking W/Glide: Load failed for http://dev-cub.changantingche.com/v4.0/picture/query/66f1ec66f53e46e2b676859d52398017 with size [879x1125]
                                                                                         class com.bumptech.glide.load.engine.GlideException: Failed to load resource
                                                                                         There was 1 cause:
                                                                                         java.lang.IndexOutOfBoundsException(Invalid index 0, size is 0)
                                                                                          call GlideException#logRootCauses(String) for more detail
                                                                                           Cause (1 of 1): class java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
07-16 10:28:31.159 3343-3343/com.maiboparking.zhangxing.client.user.xianparking I/Glide: Root cause (1 of 1)
                                                                                         java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
                                                                                             at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
                                                                                             at java.util.ArrayList.get(ArrayList.java:308)
                                                                                             at java.util.Collections$UnmodifiableList.get(Collections.java:1050)
                                                                                             at com.bumptech.glide.load.engine.ResourceCacheGenerator.startNext(ResourceCacheGenerator.java:71)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:269)
                                                                                             at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
                                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                             at java.lang.Thread.run(Thread.java:818)
                                                                                             at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)

android在使用gilde 4.8.0 加载图片的时候,原本都是好好的,然后我用了下glide的下载图片的功能,代码如下:

FutureTarget<File> target = Glide.with(LauncherActivity.this) .asFile().load(address) .submit();
File imageFile = target.get();
FilUtils.copy(imageFile,newFilePath);

这里是下载的图片,然后我在加载http的图片就加载不出来了,但是加载https的图片就可以正常显示。加载图片就的代码:

        Glide.with(mContext).load(targetMsgBean.getMessagePicture()).into(iv);

http的图片加载不出来,https的图片可以加在出来,很诡异的问题,百度google搜索了半天无法解决。

 

然后我在吧上面下载图片的代码注释掉就可以正常显示了,问题很诡异。然后我修改上面代码:

   FutureTarget<File> target = Glide.with(LauncherActivity.this).downloadOnly().load(address).submit();

添加 downloadOnly 就可以。不知道为什么。知道的麻烦说下

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值