android – 毕加索没有加载图片

前端之家收集整理的这篇文章主要介绍了android – 毕加索没有加载图片前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我一直在使用Picasso很长一段时间,但是我必须将OkHttp库升级到2.0.0,因此我必须将Picasso升级到版本2.3.2.

但是,现在Picasso根本不加载任何图像,图像视图留空.任何时候都没有出现任何错误,但是当我改变Picasso登录时,“Hunter”似乎已经被派遣并开始执行,但从未完成.

所有图像都可访问且相当小(约200px×100px).

我正在通过毕加索的“典型”方法加载图像:

Picasso.with(context).load(url).error(R.drawable.errorimg).into(imageView);

但是,从未显示errorimg.

我能做错什么?

编辑:

这是Picasso不工作的地方之一的代码(PlaceListAdapter.java – getView函数)

public View getView(int position,View convertView,ViewGroup parent) 
{
    final PBNPlace ev = values.get(position);

    LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.places_list_item,parent,false);

    TextView titleView = (TextView)rowView.findViewById(R.id.place_title);
    ImageView placeImage = (ImageView)rowView.findViewById(R.id.place_image);

    Picasso picasso = Picasso.with(context);
    picasso.load(ev.imageURL).error(R.drawable.chat).into(placeImage);

    titleView.setText(ev.name);

    return rowView;
}
最佳答案
当你升级OKHttp时,你是否也升级了okhttp-urlconnection依赖?

我遇到了这个问题,事实证明我仍然在build.gradle文件调用了版本1.6.0的okhttp-urlconnection.没有任何错误信息让我很明显我忽略了这一点.

将其更改为2.0.0解决了问题.

原文链接:https://www.f2er.com/android/431102.html

猜你在找的Android相关文章