0

I'm writing a small weather app in Android Studio (Java), and I'm having trouble with the Picasso library. The images won't load, neither in the emulator, nor in the app on my test device.

I've imported the library like so:

import com.squareup.picasso.Picasso;

This is the piece of code that I'm using to get and display the image, and normally works fine:

Picasso.get().load(url).into(imgWeatherIcon);

The url works fine, so this can't be the reason for the problem.

I'm already using the Volley HTTP library for asynchronous API Get requests, which at this point is the only reason I can think of why the Picasso methods are not working.

  • 1
    There's a little bit of configuration you have to do if your images use http (and not https) urls. [This answer](https://stackoverflow.com/a/53630194/2620627) might help you – Fabio Jul 24 '20 at 14:34
  • 1
    The images use https, so I don't think this will solve the problem. But thank you for your answer! – WhatTheCode Jul 24 '20 at 14:44
  • 1
    Do you have a logcat output with an error? – Fabio Jul 24 '20 at 14:47
  • There's nothing Picasso related in the logcat unfortunately... – WhatTheCode Jul 24 '20 at 14:52
  • 1
    Even adding Picasso.get().setLoggingEnabled(true) before the image request ? – Fabio Jul 24 '20 at 14:58
  • `2020-07-24 17:06:07.955 23641-23641/com.example.weatherapp D/Picasso: Main errored [R0]+216ms Unrecognized type of request: Request{ http://openweathermap.org/img/wn/03d@4x.png}` It appears that the images use http after all, so I'll try your first suggestion! – WhatTheCode Jul 24 '20 at 15:07
  • 1
    I've found the error, and I'm quite embarressed to say that final string url I was using, had an extra space at the start. So problem solved. Thank you very much for your help Fabio. – WhatTheCode Jul 24 '20 at 15:13
  • 1
    Glad it's solved! – Fabio Jul 24 '20 at 15:38

0 Answers0