0

I'm facing a strange issue with Picasso while loading image , it worked fine till now . i'm using Picasso in many functionality on my app but somehow it starts showing the app colorPrimary instead of the image in one case only, all other use of Picasso works fine .

enter image description here

to load image 1 :

Picasso.with(context).load(suggestion.getProfilImage()).into(profil);

to load image 2

Picasso.with(context).load(suggestion.getImage()).into(image);

so as you can see there is blue color instead of the image .

Note :

the url of the image is well loaded and tested and show the image when i test it on the browser , also in some case of my app i can load the same url and it works fine .

this worked fine but somehow it doesn't work anymore , any idea guys ?

ismail alaoui
  • 5,748
  • 2
  • 21
  • 38

2 Answers2

0

Try to load another image in the imageview with problem. Just hardcode any other url and try. If not working, try to find out the exception which is causing image to not load.

Picasso.Builder builder = new Picasso.Builder(this);
builder.listener(new Picasso.Listener()
{
    @Override
    public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception)
    {
        exception.printStackTrace();
    }
});
builder.build().load(URL).into(imageView);

If onImageLoadFailed method is not called, then there might be another possible bug, the image is loaded correctly and somewhere else you are hardcoding the colorPrimary to get loaded into the imageView(either in code or in xml or in styles) which is overwriting the image.

  • I have many url in my list to be shown and all of the profil image are blue so im sure no problem with the url because all of them work on the browser , and as u said onImageLoadFailed is not called ! And im not hardcoding the color anywhere in the xml or the image :( – ismail alaoui Apr 29 '19 at 23:55
  • if you are using older version of picasso, refer this answer for onError callback https://stackoverflow.com/a/30628461/8432542 – Atchyut Maddukuri Apr 30 '19 at 00:49
0

After getting some time with that error , i still don't know what really happened , but the problem was fixed when i cleared my app cash files !

ismail alaoui
  • 5,748
  • 2
  • 21
  • 38
  • Can you please look into this problem I could not solve this https://stackoverflow.com/questions/56513672/errorunable-to-resolve-dependency-for-appdebugandroidtest-compileclasspath @ismail alaoui – Pie Jun 09 '19 at 13:44