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 毕加索图片无法加载
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
