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
    评论
引用\[1\]和\[2\]提供了关于java.lang.NoClassDefFoundError的错误信息。这个错误通常是由于在运行时找不到特定的类而引起的。在这种情况下,错误信息指出找不到类"com.coloros.calendar.foundation.utillib.devicehelper.DeviceUtils"。根据提供的信息,这个类可能是在应用程序的路径中找不到。可能的原因是该类在应用程序的依赖项中缺失或未正确配置。为了解决这个问题,可以尝试以下几个步骤: 1. 确保在应用程序的依赖项中包含了所需的库或模块。检查项目的构建文件,例如build.gradle文件,确保所有必要的依赖项都已正确添加。 2. 如果使用了第三方库或模块,确保已正确导入并配置。检查相关的文档或指南,确保按照正确的步骤进行了配置。 3. 如果使用了混淆,确保已正确配置混淆规则,以避免将所需的类或方法从代码中删除。 4. 如果使用了多个模块或库,确保它们之间的依赖关系正确配置。检查相关的文档或指南,确保所有模块都正确地引用了所需的类。 另外,引用\[3\]提供了一些关于React Native项目的构建和打包的命令。这些命令可能与你的问题无关,因为它们主要用于React Native项目的构建和打包过程。请确保你正在使用正确的命令和配置来构建和运行你的应用程序。 综上所述,要解决java.lang.NoClassDefFoundError: Failed resolution of: Lcom/coloros/calendar/foundation/utillib/devicehelper/DeviceUtils;错误,你可以尝试检查和修复应用程序的依赖关系,确保所需的类和库正确导入和配置。 #### 引用[.reference_title] - *1* *2* [java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/integration/okhttp3/OkHttp](https://blog.csdn.net/qq_46149597/article/details/126446160)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/tencent/bugly/beta/ui/BaseFrag](https://blog.csdn.net/cimbala/article/details/124120718)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

u010833696

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值