TakuSemba/CropMe

Crash On Samsung Device

kharelpankaj opened this issue · 6 comments

Whenever I call croperview.crop, I am getting this error in Samsung device. I have tested the same code with few more device , its working fine.

FATAL EXCEPTION: main
Process: PID: 1276
java.lang.IllegalArgumentException: y + height must be <= bitmap.height()
at android.graphics.Bitmap.createBitmap(Bitmap.java:829)
at android.graphics.Bitmap.createBitmap(Bitmap.java:793)
at com.takusemba.cropme.CropView.crop(CropView.java:240)
at .Views.Activity.CropperActivity.onCrop(CropperActivity.java:44)
at .Views.Activity.CropperActivity_ViewBinding$1.doClick(CropperActivity_ViewBinding.java:33)
at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
at android.view.View.performClick(View.java:6205)
at android.widget.TextView.performClick(TextView.java:11103)
at android.view.View$PerformClick.run(View.java:23653)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

sorry for the late replay.

i tested GALAXY S5 and it worked fine.
what kind of device did you use?

@TakuSemba this is not device specific issue. The problem is sometime image not cover the whole crop are in that case this issue occured

I get the same Exception attempting to crop an image from the camera.
Images are successfully rendered only if they're selected from the device gallery.
This behavior seen using CropMe with the OnePlus 5T on stock Android version 8.1.0.

implementation 'com.github.takusemba:cropme:1.1.0'

FATAL EXCEPTION: Thread-5
Process: PID: 22330
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:1013)
at android.graphics.Bitmap.createBitmap(Bitmap.java:980)
at android.graphics.Bitmap.createBitmap(Bitmap.java:930)
at android.graphics.Bitmap.createBitmap(Bitmap.java:851)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:721)
at com.takusemba.cropme.CropLayout$4.run(CropLayout.java:171)
at java.lang.Thread.run(Thread.java:764)

I have this error if I move image out of frame and click to crop.

Can you check if the image is not off of the frame using CropLayout.isOffFrame()?

Also, can you check if this still happens on v2.0.0 which has just been released?

I'm closing this issue because I believe this is resolved adding CropLayout.isOffFrame() functionality.