ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.09k stars 1.55k forks source link

"Cannot find image data" Sony Xperia Z2 #49

Closed morelazers closed 7 years ago

morelazers commented 8 years ago

I've tried the camera feature on a few Android phones and it works just fine (OnePlus One, MotoG3) but when I'm trying it on a Sony Xperia Z2 I'm getting the error "Cannot find image data" after taking a picture.

I have noticed that on the working devices after taking a picture there is a 'confirmation screen' where the user can decide if the image is good enough to go to the cropper, however there isn't on the Z2, the cropper flashes up and then disappears before throwing the error.

The .openPicker() function works great on all devices.

Potentially a problem with the Sony camera not going through the same motions as the stock android camera?

Not sure how to provide a stack trace, let me know if there's more info that I can provide.

Awesome library :) thanks!

ivpusic commented 8 years ago

Thank you for reporting this. Stacktrace would be nice. You can open android studio and run the project from there. Then wait until error happens, and copy/paste output from the console (not browser console, but android-studio console).

Additionally, can you tell me more about Z2 phone? Does it use/has a memory card?

morelazers commented 8 years ago
08-24 15:23:21.234: E/TransformImageView(9951): onFailure: setImageUri
08-24 15:23:21.234: E/TransformImageView(9951): java.lang.IllegalArgumentException: Bounds for bitmap could not be retrieved from Uri
08-24 15:23:21.234: E/TransformImageView(9951):     at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:105)
08-24 15:23:21.234: E/TransformImageView(9951):     at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:35)
08-24 15:23:21.234: E/TransformImageView(9951):     at android.os.AsyncTask$2.call(AsyncTask.java:295)
08-24 15:23:21.234: E/TransformImageView(9951):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-24 15:23:21.234: E/TransformImageView(9951):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
08-24 15:23:21.234: E/TransformImageView(9951):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
08-24 15:23:21.234: E/TransformImageView(9951):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
08-24 15:23:21.234: E/TransformImageView(9951):     at java.lang.Thread.run(Thread.java:818)

I think this is the relevant part of the stacktrace.

morelazers commented 8 years ago

The phone has no external memory installed, though it does have space for it. Android version: 6.0.1 Stock ROM

ivpusic commented 8 years ago

Hm, I am trying on phones which I have, and it works there. Do you have maybe time to try to debug it with the phone which is causing troubles? I can help you if you need something while doing that.

morelazers commented 8 years ago

Thanks! I noticed some strange behaviour with the phone earlier; I was on the camera screen, then I exited back to the homescreen with the native android home button, when I reopened the app back into the camera screen, everything worked.

I'm really stuck, maybe it is just a problem with the phone's ROM?

ivpusic commented 8 years ago

weird. Can you please check if the file is created after you take the photo. https://github.com/ivpusic/react-native-image-crop-picker/blob/master/android/src/main/java/com/reactnative/picker/PickerModule.java#L122

The error you got is coming from ucrop, the library for cropping image.

morelazers commented 8 years ago

Very strange behaviour, if we interact with a 'background' process, like drag a facebook chat head, then take the photo, it works as expected.

I will try to check the File object tomorrow when I have the phone again.

ivpusic commented 8 years ago

thanks. Keep me posted

ivpusic commented 8 years ago

Just published new version with uCrop upgrade. https://github.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.7.0. Can you please try it out. Maybe it solves this issue.

morelazers commented 8 years ago

Can confirm that this does not fix the issue. I have no access to the phone for a while since it is my friend's, but I will report back as soon as I can, probably be >1week due to holiday.

Thank you so much for your help so far.

markxh commented 8 years ago

I'm running this on Xperia Z3 and get the same issue when using camera. Works fine when using gallery.

ivpusic commented 8 years ago

@markxh as I don't have Xperia Z3 phone, I would really appreciate it if you could try to figure out why is this happening on this phone

markxh commented 8 years ago

Ok will see what I can do!

ivpusic commented 8 years ago

@markxh @morelazers please try this version https://github.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.9.0. It might be relevant to this issue.

ivpusic commented 7 years ago

closing this one as probably obsolete. Please try latest version and reopen issue if you still have a problem.