Android Picasso Image does not load(Android 毕加索图片无法加载)
问题描述
我加载图片有两种情况,第一种,直接从互联网上加载,第二种,加载在设备中下载的图片.每当我加载时,都会显示 10 张图片中的 8~9 张,并且丢失了 1-2 张.我看到解码返回错误,并且尽我所能用谷歌搜索,但无法找到.
<块引用>- WAIT_FOR_CONCURRENT_GC 阻塞了 22 毫秒
- WAIT_FOR_CONCURRENT_GC 阻塞了 20 毫秒
- GC_FOR_ALLOC 释放 718K,31% 释放 9948K/14256K,暂停 49ms,总共 51ms
- D/skia: ---decoder->decode returned falseGC_CONCURRENT freed 1370K, 30% free 10081K/14256K, paused 3ms+2ms,总共33ms
- GC_FOR_ALLOC 释放 916K,30% 释放 10029K/14256K,暂停 66ms,总共 67ms
这是我用来通过 Picasso 加载的代码:
Picasso.with(activity).load(路径).placeholder(R.drawable.thumbnail_placeholder).resize(宽度,高度).into(imageView);
任何想法如何解决这个问题?每次我将图像加载到屏幕上时,我都会调用 fit()/resize() .非常感谢您的帮助,在此先感谢!
仅供参考,我在两台机器上进行了测试,模拟器和真实设备三星 Galaxy Tab 3,在模拟器上运行没有任何问题,但在真实设备上出现问题.
更新:
这是由图像的颜色空间引起的,其中未显示的图像是 YMCK 颜色空间中的图像.
您可以使用 Picasso.with(Context).setLoggingEnabled(true)
开启 Picasso 日志.您可能会在此处看到带有原因的错误消息.
还值得记录您正在使用的 URL 并在浏览器中尝试,以防万一.
There are two situations I load images, first, just directly from the internet, and second, load images that are downloaded in the device. And whenever I load, 8~9 out of 10 images are shown, and 1-2 missing. I see that decode returned false, and google'd as hard as I can, but couldn't come up.
- WAIT_FOR_CONCURRENT_GC blocked 22ms
- WAIT_FOR_CONCURRENT_GC blocked 20ms
- GC_FOR_ALLOC freed 718K, 31% free 9948K/14256K, paused 49ms, total 51ms
- D/skia: --- decoder->decode returned falseGC_CONCURRENT freed 1370K, 30% free 10081K/14256K, paused 3ms+2ms, total 33ms
- GC_FOR_ALLOC freed 916K, 30% free 10029K/14256K, paused 66ms, total 67ms
Here's code I use to load through Picasso:
Picasso.with(activity)
.load(path)
.placeholder(R.drawable.thumbnail_placeholder)
.resize(width,height)
.into(imageView);
Any ideas how to solve this issue? I am calling fit()/resize() every time I get the images to load on the screen. Help much appreciated, thanks in advance!
FYI, I test on both machines, emulator and the real device, Samsung Galaxy Tab 3, and works without any problems on emulator, but problems occur on real device.
UPDATE:
It was causing by image's color space, where images that weren't showing up were the ones that were in YMCK color space.
You can turn on Picasso logs using Picasso.with(Context).setLoggingEnabled(true)
. You will probably see an error message with a reason there.
It's also worth logging the URL you are using and trying it a browser, just in case.
这篇关于Android 毕加索图片无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android 毕加索图片无法加载


- Android viewpager检测滑动超出范围 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01