0

Using Picasso (version 2.5.2) in my android project and trying to load all the images stored in the device in a grid view. Picasso is successfully loading all the images stored in the internal storage but not loading those from the external storage. Also, not getting any errors in the log.

I also checked if the file exists and loaded that successfully in a view using Glide library.

Sample external file path: /storage/0403-0201/DCIM/Camera/IMG_20180309_120329.jpg

Sumit Saurabh
  • 1,366
  • 1
  • 19
  • 33
  • "not getting any errors in the log" -- AFAIK, there will not be any errors, unless you log them yourself: https://stackoverflow.com/q/25744344/115145 – CommonsWare Mar 11 '18 at 12:14
  • 1
    add READ_EXTERNAL_STORAGE permission to manifest and handle the request to user for granting permission. – Rahul Mar 11 '18 at 12:23
  • @RahulKumar, Ohh forgot to mention that the required permission has already been added in the manifest. – Sumit Saurabh Mar 11 '18 at 12:50

1 Answers1

0

@CommonsWare, Thanks a lot! I attached Picasso.Listener and got the following stack trace-

W/System.err﹕ java.io.IOException: Cannot reset
W/System.err﹕ at com.squareup.picasso.MarkableInputStream.reset(MarkableInputStream.java:99)
W/System.err﹕ at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:140)
W/System.err﹕ at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:217)
W/System.err﹕ at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
W/System.err﹕ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
W/System.err﹕ at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:394)
W/System.err﹕ java.io.IOException: Cannot reset
W/System.err﹕ at com.squareup.picasso.MarkableInputStream.reset(MarkableInputStream.java:99)
W/System.err﹕ at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:140)
W/System.err﹕ at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:217)
W/System.err﹕ at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
W/System.err﹕ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
W/System.err﹕ at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:394)

I explored this error and found that Picasso 2.5.2 does not display big images and same has been filed as a bug on Picasso github page.

https://github.com/square/picasso/issues/907

Solution: Picasso 2.5.x is having the bug but version 2.4.0 is working fine.

Sumit Saurabh
  • 1,366
  • 1
  • 19
  • 33