Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap from camera not loaded - Moto G Android 5.0.1 #1069

Closed
leolanzinger opened this issue Jun 19, 2015 · 37 comments
Closed

Bitmap from camera not loaded - Moto G Android 5.0.1 #1069

leolanzinger opened this issue Jun 19, 2015 · 37 comments

Comments

@leolanzinger
Copy link

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

@Juleship
Copy link

+1

@leolanzinger
Copy link
Author

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

@squeeish
Copy link

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)
            ......

@emanuelcanha
Copy link

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)

@leolanzinger
Copy link
Author

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

@leolanzinger
Copy link
Author

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.

@fmweigl
Copy link

fmweigl commented Jul 13, 2015

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);

@SagarPanwala
Copy link

+1
Facing the same issue.

@anidotnet
Copy link

+1
Facing same. Getting exception:

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

@anuraghtc
Copy link

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: #1 pc 000aa0c3 /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread_)+98)
native: #2 pc 00235713 /system/lib/libart.so (art::Thread::FullSuspendCheck()+898)
native: #3 pc 00292dc1 /system/lib/libart.so (art::GoToRunnable(art::Thread_)+336)
native: #4 pc 00087881 /system/lib/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+16)
native: #5 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)

@markini
Copy link

markini commented Sep 17, 2015

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.

@mschultheiss
Copy link

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

@dmnugent80
Copy link

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

@muditjaju
Copy link

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

@ankitbatra11
Copy link

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

@vjdhama
Copy link

vjdhama commented Dec 16, 2015

+1. Same issue.

@abhinandankothari
Copy link

+1

@StevenTB
Copy link

+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

@sidhantpanda
Copy link

+1 Moto G with Android 5.0.2

Update:
Tried same with Glide, works smoothly

@raviteja06
Copy link

+1 Moto G3 with android 6.0

@toodee
Copy link

toodee commented Jan 28, 2016

+1 on Nexus 5, Android 6.0.1

@engineers-bojan
Copy link

+1 Moto XT1068 (G2), Android 5.0.2

1 similar comment
@ondreju93
Copy link

+1 Moto XT1068 (G2), Android 5.0.2

@aried3r
Copy link

aried3r commented Feb 23, 2016

@JakeWharton I think this has been fixed in the master branch via b61c5d4, correct?

@JakeWharton
Copy link
Collaborator

Yep. Thanks.

@JakeWharton
Copy link
Collaborator

I mean +1

@aried3r
Copy link

aried3r commented Feb 23, 2016

Oh, you ;)

@sudeeps-r
Copy link

@aried3r did you release the build

@aried3r
Copy link

aried3r commented Mar 5, 2016

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
#1069 (comment).

@SagarPanwala
Copy link

Is this issue is fixed or not?

@aried3r
Copy link

aried3r commented Mar 10, 2016

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
#1069 (comment).

@Fan0932
Copy link

Fan0932 commented Oct 14, 2016

moto x style +1

@aemxn
Copy link

aemxn commented Dec 21, 2016

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

@rocboronat
Copy link

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

@rocboronat
Copy link

Going back to Picasso 2.4.0 fixes the issue. WOAW

@amruta-gosavi
Copy link

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

@JakeWharton
Copy link
Collaborator

JakeWharton commented Apr 19, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests