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 毕加索图片无法加载
基础教程推荐
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01