Picasso: Bitmap from camera not loaded - Moto G Android 5.0.1

Created on 19 Jun 2015  Â·  37Comments  Â·  Source: square/picasso

As discussed in issue #539 I am encountering this problem again, since that issue is now closed I am opening a new one to report this bug:
Picasso 2.5.2 fails to load images from the local Uri of an image captured via a Camera Intent (the manifest has all the required permission to work with STORAGE and DOCUMENTS).
It doesn't throw any exception, the only trace I get of this error is when I attach a Target to the ImageView and it triggers the onBitmapFailed() method.
I am using a Moto G on Android 5.0.1.
NB: it may be useful to know that I don't get this error using Genymotion's emulator camera.

Thanks

Most helpful comment

Going back to Picasso 2.4.0 fixes the issue. WOAW

All 37 comments

+1

Also, I noticed the same problem trying to load local Uri's ("content://com.android.providers.media.documents/document/" etc.) of large images ( > 1 MB). Any help would be really appreciated
Ty

Seems like that well-known marker issue. Attach a listener to confirm:

Picasso picasso = new Picasso.Builder(getActivity()).listener(new Picasso.Listener() {
    @Override public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
        exception.printStackTrace();
    }
}).build();

picasso.load(yourProblematicImage)
            ......

I'm having the same issue on a Moto G - Android 5.0.2.

Here is a stack trace of the above listener:

java.lang.IllegalStateException: Unrecognized type of request: Request{/storage/emulated/0/Pictures/image.jpg resize(120,120)} W/System.err﹕ at com.squareup.picasso.BitmapHunter$2.load(BitmapHunter.java:66) W/System.err﹕ at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:206) 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:818) W/System.err﹕ at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)

@squeeish I am not getting any exception thrown from this listener.

So I figured out that it works simply if I get the absolute url of the file (of the format file:///content/.. ). But I still don't get why using Uri it crashes with high-res images.

I have the same problem here only on some Samsung devices.
I get an image file with:

File[] picFiles = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).listFiles();
File file = picFile[0];

and try to display it with

Picasso.with(getActivity()).load(Uri.fromFile(file)).into(imageView);

or

Picasso.with(getActivity()).load("file://" + file.getAbsolutePath()).into(imageView);

+1
Facing the same issue.

+1
Facing same. Getting exception:

Unrecognized type of request: Request{/storage/emulated/0/Android/data/org.abstractclass.appthree/files/Pictures/img_9206033081671572937.png}

I am facing the same problem only on my moto X (2nd gen) running lollipop 5.1. All other device work fine. Here is a trace that art dumped that may be relevant.

native: #01 pc 000aa0c3 /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread_)+98)
native: #02 pc 00235713 /system/lib/libart.so (art::Thread::FullSuspendCheck()+898)
native: #03 pc 00292dc1 /system/lib/libart.so (art::GoToRunnable(art::Thread_)+336)
native: #04 pc 00087881 /system/lib/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+16)
native: #05 pc 0009a947 /system/framework/arm/boot.oat (Java_java_lang_System_arraycopyCharUnchecked___3CI_3CII+162)
at java.lang.System.arraycopyCharUnchecked!(Native method)
at java.lang.System.arraycopy(System.java:220)
at java.lang.String.(String.java:402)
at java.lang.AbstractStringBuilder.toString(AbstractStringBuilder.java:633)
at java.lang.StringBuilder.toString(StringBuilder.java:663)
at com.squareup.picasso.Utils.createKey(Utils.java:217)
at com.squareup.picasso.Utils.createKey(Utils.java:173)
at com.squareup.picasso.RequestCreator.into(RequestCreator.java:512)
at com.a.b.onCreateView(ChoosePictureFragment.java:164)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
at com.a.b.activities.BaseActivity.onStart(BaseActivity.java:426)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1259)

Same issue on the Moto G 3rd generation with 5.1.1
I had to set the marker to a higher number than stated in #364. 65536 + 2048 wasn't enough.

Also getting the error on MotoG 2nd Generation. The debugger shows an exception in complete(): 510 here:

java.io.IOException: Cannot reset

I am using Picasso Version 2.5.2

Also seeing image loading getting into onBitmapFailed() only for images taken from the camera on a Moto G and a Lenovo A7000.

It works just fine on other devices tested.

Also note that on the Moto G and the Lenovo A7000, loading images from the gallery that were not taken with the camera works just fine.
Taking a photo with the camera or choosing an image in the gallery that was taken with the camera, however, results in it going into onBitmapFailed() every time.

I tried attaching a Listener, and it doesn't get into onImageLoadFailed().

For images chosen from the gallery, here is the format of the Uri returned from calling getData() on the Intent in onActivityResult():

content://com.android.providers.media.documents/document/image%3A174

For images taken with the camera, here is the format of the Uri (constructed using Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)):

file:///storage/sdcard0/Pictures/JPEG_20151008_173640_67168147.jpg

Using version 2.5.2

Can confirm I am also facing the same issue on my Moto X - 5.0.1
I switched to Glide image library and everything is working like a charm now

Hi,
I am also facing the same issue on Moto G3 (running 5.1.1). Is there a fix available?

+1. Same issue.

+1

+1, I'm facing the same issue since 2.5.0 on Nexus 5 6.0.1

Update : I also switched into Glide which works pretty well

+1 Moto G with Android 5.0.2

Update:
Tried same with Glide, works smoothly

+1 Moto G3 with android 6.0

+1 on Nexus 5, Android 6.0.1

+1 Moto XT1068 (G2), Android 5.0.2

+1 Moto XT1068 (G2), Android 5.0.2

@JakeWharton I think this has been fixed in the master branch via https://github.com/square/picasso/commit/b61c5d42da7243eab27b16a3396f8be4aff00084, correct?

Yep. Thanks.

I mean +1

Oh, you ;)

@aried3r did you release the build

I'm not part of the Square team or one of the maintainers. Either wait for
2.6 stable or try the SNAPSHOT release in your dev builds.

On Sat, Mar 5, 2016, 14:12 sudeeps-r [email protected] wrote:

@aried3r https://github.com/aried3r did you release the build

—
Reply to this email directly or view it on GitHub
https://github.com/square/picasso/issues/1069#issuecomment-192640541.

Is this issue is fixed or not?

It is.

On Thu, Mar 10, 2016, 04:21 SagarPanwala [email protected] wrote:

Is this issue is fixed or not?

—
Reply to this email directly or view it on GitHub
https://github.com/square/picasso/issues/1069#issuecomment-194641977.

moto x style +1

Getting this message on 2.5.2, Nexus 5X (7.1.1)

Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{e8a7979 2094:derp.com.app.debug/u0a289} (pid=2094, uid=10289) requires android.permission.MANAGE_DOCUMENTS or android.permission.MANAGE_DOCUMENTS

Added said permission in the manifest, still issue persists

Path is taken from Uri.getPath and the String is persisted in the db. (that shouldn't be any problem, I guess).

I supplied the image as follows:

String imageUrl = photo.getLocalPath();

Picasso picasso = new Picasso.Builder(itemView.getContext())
        .listener(new Picasso.Listener() {
            @Override
            public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
                L.tag("onImageLoadFailed", exception.getMessage());
                L.tag("onImageLoadFailed", "Uri: " + uri.getPath());
            }
        }).build();
picasso
        .load(imageUrl)
        .resize(400, 400)
        .centerInside()
        .noPlaceholder()
        .into(mImg);

UPDATE

Added a string Uri path from QuickPic (or other app for that matter), it does work.

  • Uri from recent document: content://com.android.providers.media.documents/document/image%3A9069 Not working
  • Uri from QuickPic app: content://media/external/images/media/6732 Working

Moto G 4 Plus ... +1. Using Picasso 2.5.2 😢

Going back to Picasso 2.4.0 fixes the issue. WOAW

I am facing the same issue using Picasso 2.5.2. Is there any workaround for this issue?

Try 3.0.0-SNAPSHOT?

On Wed, Apr 19, 2017, 1:00 PM amruta-gosavi notifications@github.com
wrote:

I am facing the same issue using Picasso 2.5.2. Is there any workaround
for this issue?

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/square/picasso/issues/1069#issuecomment-295368678,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEZlvzFFgefHnYL2m5J8IvHJvLD0Bks5rxku1gaJpZM4FHNFZ
.

Was this page helpful?
0 / 5 - 0 ratings