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

Crop not showing on android #66

Closed magrinj closed 8 years ago

magrinj commented 8 years ago

Version

Tell us which versions you are using:

After I select a picture on android, normally the next view with cropping would appear.

Actual behaviour

Just after I select a picture on android I can't crop my picture, when I select it, the view go back to the last view and that's it.

Steps to reproduce

  1. npm i react-native-image-crop-picker --save
  2. react-native link react-native-image-crop-picker
  3. react-native run-android

    Attachments

{ "framesToPop": 1, "code": "E_ACTIVITY_DOES_NOT_EXIST" }

ivpusic commented 8 years ago

@magrinj are you passing cropping: true flag? What phone you are using?

magrinj commented 8 years ago

Yes I pass cropping: true, the phone I use is a Motorola Moto E, with the version of image-crop-picker 5.5.0 that's working, I don't really understand why

ivpusic commented 8 years ago

Hm, I don't have that phone, and on mine phones it works. your version is using newer ucrop (2.1.2). Can you try to put compile 'com.yalantis:ucrop:1.5.0' instead of compile 'com.yalantis:ucrop:2.1.2' and see if it works

magrinj commented 8 years ago

Ok I'm going to try, I let you know

magrinj commented 8 years ago

Same error with the version 1.5.0 of ucrop. I don't really understand what's happen :/

Edit: Cropping works on iOS, the problem is only on Android

ivpusic commented 8 years ago

do you get any stacktrace which could be useful for debugging?

magrinj commented 8 years ago

The stack trace I got is in the catch of ImageCropPicker, and I got this:

error: { "framesToPop": 1, "code": "E_ACTIVITY_DOES_NOT_EXIST" }

stack trace:

screenshot_20160908-121650

ivpusic commented 8 years ago

can you run project within android studio, and give me stacktrace from there?

morelazers commented 8 years ago
09-10 15:41:09.223: E/qomx_image_core(341): OMX_Deinit:119] Complete
09-10 15:41:09.226: E/QCameraPostProc(341): int32_t qcamera::QCameraPostProcessor::deinit(): Jpeg closed, rc = 0, mJpegClientHandle = a400
09-10 15:41:09.255: E/libEGL(17347): call to OpenGL ES API with no current context (logged once per thread)

Having the same issue, hopefully this is the relevant part of the stacktrace

Also seeing this quite a lot

09-10 15:48:10.223: E/Surface(1876): getSlotFromBufferLocked: unknown buffer: 0xb94a2208
morelazers commented 8 years ago

Took out the cropping: true option and caught this:

09-11 15:53:35.865: E/BitmapFactory(4930): Unable to decode stream: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference
09-11 15:53:35.884: E/AndroidRuntime(4930): FATAL EXCEPTION: main
09-11 15:53:35.884: E/AndroidRuntime(4930): Process: com.challengr, PID: 4930
09-11 15:53:35.884: E/AndroidRuntime(4930): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=null} to activity {com.challengr/com.challengr.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3720)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3763)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.app.ActivityThread.-wrap16(ActivityThread.java)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.os.Handler.dispatchMessage(Handler.java:102)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.os.Looper.loop(Looper.java:148)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.app.ActivityThread.main(ActivityThread.java:5443)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at java.lang.reflect.Method.invoke(Native Method)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-11 15:53:35.884: E/AndroidRuntime(4930): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference
09-11 15:53:35.884: E/AndroidRuntime(4930):     at java.io.File.fixSlashes(File.java:183)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at java.io.File.<init>(File.java:130)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.reactnative.ivpusic.imagepicker.PickerModule.getBase64StringFromFile(PickerModule.java:171)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.reactnative.ivpusic.imagepicker.PickerModule.getImage(PickerModule.java:218)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.reactnative.ivpusic.imagepicker.PickerModule.cameraPickerResult(PickerModule.java:290)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.reactnative.ivpusic.imagepicker.PickerModule.onActivityResult(PickerModule.java:313)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:210)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.facebook.react.XReactInstanceManagerImpl.onActivityResult(XReactInstanceManagerImpl.java:595)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:147)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at com.challengr.MainActivity.onActivityResult(MainActivity.java:26)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.app.Activity.dispatchActivityResult(Activity.java:6442)
09-11 15:53:35.884: E/AndroidRuntime(4930):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3716)
09-11 15:53:35.884: E/AndroidRuntime(4930):     ... 9 more
ivpusic commented 8 years ago

@morelazers @magrinj please try new release https://github.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.8.3. It includes improvements related to cropping.

Please let me know how it works for you.

morelazers commented 8 years ago

@ivpusic works, thank you so much! Not sure what the problem was, but I also have a Motorola phone (Moto G 2015) if it's relevant :)

VincentRong commented 6 years ago

@ivpusic Hi, sorry for commenting at the closed issue, but I encounter the similar problem here. I wonder what modification of your new release about this problem?