Android – Picasso not loading images

androidimageloadingokhttppicasso

I have been using Picasso for quite some time, but I had to upgrade OkHttp library to 2.0.0 and, consequently, I had to upgrade Picasso to version 2.3.2.

However, now Picasso does not load any image at all, the imageviews are left empty. No error shows up at any time, but when I turned Picasso logging on, the "Hunter" seems to be dispatched and starts executing, but never finishes.

All the images are accessible and rather small (around 200px by 100px).

I'm loading the images through Picasso's "typical" method:

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

However, the errorimg is never shown.

What could I be doing wrong?

EDIT:

Here is the code of one of the places where Picasso is not working (PlaceListAdapter.java – getView function)

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;
}

Best Answer

When you upgraded OKHttp, did you also upgrade the okhttp-urlconnection dependency?

I had this issue and it turned out I was still calling for version 1.6.0 of okhttp-urlconnection in my build.gradle file. There were no error messages that made it readily apparent to me that I had overlooked this.

Changing that to 2.0.0 solved the problem.

Related Topic