picasso: Picasso does not load the image nor does it log

I am supplying picasso through Koin (DI).

This is my Picasso configuration

fun getPicasso(context: Context, downloader: OkHttp3Downloader): Picasso {
    return Picasso.Builder(context)
            .downloader(downloader)
            .indicatorsEnabled(true)
            .loggingEnabled(true)
            .build()

}

This is theOkHttp3 and OkHttp3Downloader

fun getPicassoDownloader(okHttpClient: OkHttpClient): OkHttp3Downloader {
    return OkHttp3Downloader(okHttpClient)
}
fun getOkHttpInstance(headerInterceptor: HeaderInterceptor, loggingInterceptor: HttpLoggingInterceptor, cache: Cache): OkHttpClient {
    return OkHttpClient.Builder()
            .addInterceptor(headerInterceptor)
            .addInterceptor(loggingInterceptor)
            .cache(cache)
            .build()
}

This OkHttp3 is a singleton used across every entity that requires it such as Retrofit, Picasso.

I then load the image like this in a recycler view

picasso.load(image.urls?.regular)
                    .fit()
                    .centerCrop()
                    .into(itemView.item_image)

I have logged the URL’s and verified that the URL’s are working But I see no image in the imageView nor do I see any logs as I’ve set logging interceptor to be true.

I also tried commenting out the OkHttpDownloader instance in picasso so that I use the default configuration. But that doesn’t work either.

Picasso Version : 2.71828 OkHttp3Downloader Version: 1.1.0 OkHttp3 Version : 3.10.0

Android Device : One Plus 6 Android Version : 8.1.0 Android OS : Oxygen OS 5.1.8

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 4
  • Comments: 21 (3 by maintainers)

Most upvoted comments

Here is working project with the issue. https://github.com/Kolyall/Picasso271828 To fix it use com.squareup.picasso.OkHttp3Downloader instead of com.jakewharton.picasso.OkHttp3Downloader

Be oversure image URL path with https protocol, hopefully, it will be work!!!

Example:

https😕/bangladhol.com/book_th/C29B5E81.jpg

instead of

http😕/bangladhol.com/book_th/C29B5E81.jpg

@FantasyLand17 gave me a hint I removed this form my code and it’s working fine.

OkHttp3Downloader okHttp3Downloader = new OkHttp3Downloader(context, Integer.MAX_VALUE);
picassoBuilder.downloader(okHttp3Downloader);

I can confirm that this issue is still present after updating to Picasso 2.7. I have narrowed it down to this:

This does NOT work

@Provides @Singleton
 Picasso providePicasso(Application app, OkHttpClient client) {
     return new Picasso.Builder(app)
             .downloader(new OkHttp3Downloader(client))
             .listener(new Picasso.Listener() {
                 @Override
                 public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
                     Timber.e(exception, "Failed to load image: %s", uri);
                 }
             })
             .build();
 }

This works ( Notice missing OkHttp3Downloader ):

@Provides @Singleton
 Picasso providePicasso(Application app, OkHttpClient client) {
     return new Picasso.Builder(app)
             .listener(new Picasso.Listener() {
                 @Override
                 public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
                     Timber.e(exception, "Failed to load image: %s", uri);
                 }
             })
             .build();
 }

I am not sure how to debug this but what appears to be happening is that something is going on with OkHttp3Downloader and PIcasso 2.7

EDIT: it looks like there is a reason for that #31

@JakeWharton maybe this issue could be closed?


OLD: The same happened to me, using OkHttp3Downloader 1.1.0 with Picasso 2.7 results in no images showing with the following code:

Picasso picasso = new Picasso.Builder(this)
                .downloader(new OkHttp3Downloader(okHttpClient))
                .build();
Picasso.setSingletonInstance(picasso);

but it works as expected if the downloader is removed.

Can confirm, replacing Jake’s Downloader with Squareup OkHttp3Downloader fixed this issue. (Using picassoVersion = ‘2.71828’)

I confirm that no image is shown when we use OkHttp3Downloader with Picasso 2.7 Version 2.7 works fine without setting a downloader

I met the “same” problem and finally found out the reason: my system time was incorrect, accidentally set system time to future. That’s not Picasso’s problem. 😛

I have similar problem I have updated from 2.5.2 to 2.71828 And changed Picasso.with(context) to Picasso.get() On previous version everything worked, URL are valid

Here is the log: with transformation

06-25 19:57:38.494 15724-15724/com.oitchau.debug D/Picasso: Main created [R1] Request{http://res.cloudinary.com/rnaz/image/upload/c_fill,g_face:center,h_100,q_auto:best,w_100/v1/samples/people/smiling-man.jpg CropCircleTransformation()} 06-25 19:57:38.497 15724-15801/com.oitchau.debug D/Picasso: Hunter joined [R1]+1ms to [R0]+13s, [R1]+2ms

without

06-25 20:00:08.758 16068-16068/com.oitchau.debug D/Picasso: Main created [R0] Request{http://res.cloudinary.com/rnaz/image/upload/c_fill,g_face:center,h_100,q_auto:best,w_100/v1/samples/people/smiling-man.jpg} 06-25 20:00:08.775 16068-16133/com.oitchau.debug D/Picasso: Dispatcher enqueued [R0]+16ms 06-25 20:00:08.789 16068-16179/com.oitchau.debug D/Picasso: Hunter executing [R0]+31ms