Android 毕加索图片无法加载 [英] Android Picasso Image does not load

查看:13
本文介绍了Android 毕加索图片无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我加载图片有两种情况,第一种,直接从互联网上加载,第二种,加载在设备中下载的图片.每当我加载时,都会显示 10 张图片中的 8~9 张,并且丢失了 1-2 张.我看到解码返回错误,并且尽我所能用谷歌搜索,但无法找到.

<块引用>

  1. WAIT_FOR_CONCURRENT_GC 阻塞了 22 毫秒
  2. WAIT_FOR_CONCURRENT_GC 阻塞了 20 毫秒
  3. GC_FOR_ALLOC 释放 718K,31% 释放 9948K/14256K,暂停 49ms,总共 51ms
  4. D/skia: ---decoder->decode returned falseGC_CONCURRENT freed 1370K, 30% free 10081K/14256K, paused 3ms+2ms,总共33ms
  5. 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.

  1. WAIT_FOR_CONCURRENT_GC blocked 22ms
  2. WAIT_FOR_CONCURRENT_GC blocked 20ms
  3. GC_FOR_ALLOC freed 718K, 31% free 9948K/14256K, paused 49ms, total 51ms
  4. D/skia: --- decoder->decode returned falseGC_CONCURRENT freed 1370K, 30% free 10081K/14256K, paused 3ms+2ms, total 33ms
  5. 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 毕加索图片无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆