Android Picasso image not loading

There are two situations when I download images, first directly from the Internet, and secondly I download images that are downloaded to the device. And whenever I upload, 8 ~ 9 out of 10 images are displayed, and 1-2 is missing. I see that decoding returned false and google'd with all my might, but I could not think of.

  • WAIT_FOR_CONCURRENT_GC blocked 22 ms
  • WAIT_FOR_CONCURRENT_GC blocked 20 ms
  • GC_FOR_ALLOC released 718K, 31% free 9948K / 14256K, suspended 49ms, only 51ms
  • D / skia: --- decoder-> decoded returned falseGC_CONCURRENT released 1370K, 30% free 10081K / 14256K, suspended 3 ms + 2 ms, only 33 ms
  • GC_FOR_ALLOC released 916K, 30% free 10029K / 14256K, suspended 66 ms, only 67 ms

Here is the code that I use to download via Picasso:

        Picasso.with(activity)
            .load(path)
            .placeholder(R.drawable.thumbnail_placeholder)
            .resize(width,height)
            .into(imageView);

Any ideas how to solve this problem? I call fit () / resize () every time I get images loaded onto the screen. Help evaluate, thanks in advance!

FYI, I test on both machines, the emulator and the real device Samsung Galaxy Tab 3 and it works without problems on the emulator, but problems arise on the real device.

UPDATE:

This caused the color space of the image, where the images that were not displayed were those that were in the YMCK color space.

+9
source share
7 answers

You can enable Picasso logs using Picasso.with(Context).setLoggingEnabled(true). You will probably see an error message with the reason.

URL-, , .

+25

-

<uses-permission android:name="android.permission.INTERNET"/>
+18

Picasso url .load() File .

, , :

        Picasso.with(activity)
                .load(new File(path))
                .placeholder(R.drawable.thumbnail_placeholder)
                .resize(width,height)
                .into(imageView);

:

        Picasso.with(activity)
                .load(path)
                .placeholder(R.drawable.thumbnail_placeholder)
                .resize(width,height)
                .into(imageView);
+8

, , Glide Picasso.

+6

- , - - , , url , - , , , picasso , :

final OkHttpClient client = new OkHttpClient.Builder()
        .protocols(Collections.singletonList(Protocol.HTTP_1_1))
        .build();

final Picasso picasso = new Picasso.Builder(this)
        .downloader(new OkHttp3Downloader(client))
        .build();

Picasso.setSingletonInstance(picasso);

OkHttp3Downloader . https://github.com/JakeWharton/picasso2-okhttp3-downloader

+2

Picasso:

, ImageView, @Samuil Yanovski.

, !

+1

, Firebase, URL, Picasso, ; .

, , .

, , . 500x500, .

. , FireStore, Picasso. , , onActivityResult(), firestore.

+1
source

All Articles