cometchat / cometchat-uikit-android

Ready-to-use Chat UI Components for Android
https://www.cometchat.com
44 stars 26 forks source link

Fatal Exception: java.lang.RuntimeException Canvas: trying to draw too large(256576512bytes) bitmap. #4

Closed Nivs113 closed 3 years ago

Nivs113 commented 3 years ago

Fatal Exception: java.lang.RuntimeException

Canvas: trying to draw too large(256576512bytes) bitmap.

This issue faced when large image try to load in CometChatMediaViewActivity.java

Fatal Exception: java.lang.RuntimeException: Canvas: trying to draw too large(256576512bytes) bitmap. at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:229) at android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:101) at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545) at android.widget.ImageView.onDraw(ImageView.java:1360) at android.view.View.draw(View.java:21881) at android.view.View.updateDisplayListIfDirty(View.java:20754) at android.view.View.draw(View.java:21607) at android.view.ViewGroup.drawChild(ViewGroup.java:4558) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4333) at android.view.View.updateDisplayListIfDirty(View.java:20740) at android.view.View.draw(View.java:21607) at android.view.ViewGroup.drawChild(ViewGroup.java:4558) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4333) at android.view.View.draw(View.java:21884) at android.view.View.updateDisplayListIfDirty(View.java:20754) at android.view.View.draw(View.java:21607) at android.view.ViewGroup.drawChild(ViewGroup.java:4558) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4333) at android.view.View.updateDisplayListIfDirty(View.java:20740) at android.view.View.draw(View.java:21607) at android.view.ViewGroup.drawChild(ViewGroup.java:4558) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4333) at android.view.View.updateDisplayListIfDirty(View.java:20740) at android.view.View.draw(View.java:21607) at android.view.ViewGroup.drawChild(ViewGroup.java:4558) at androidx.recyclerview.widget.RecyclerView.drawChild(RecyclerView.java:5030) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4333) at android.view.View.draw(View.java:21884) at androidx.recyclerview.widget.RecyclerView.draw(RecyclerView.java:4429) at android.view.View.updateDisplayListIfDirty(View.java:20754) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4542) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4514) at android.view.View.updateDisplayListIfDirty(View.java:20709) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:725) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:731) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:840) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3947) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3721) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3029) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1888) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8511) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer.doFrame(Choreographer.java:696) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7050) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

darshanbhanushali commented 3 years ago

Hi @Nivs113 , Is it possible for you share the image file with us.

Also we would like to know if it happens everytime or only for specific image.

Nivs113 commented 3 years ago

Hi @darshanbhanushali

I have sent a sample image for you on mail because on here i can't upload greater than 10MB. I have checked with this image also. please check with this file.

darshanbhanushali commented 3 years ago

Hi @Nivs113 ,

We were able to replicate the issue...It was Glide CustomTarget issue were it fails to load image with larger size. If you can replace ZoomImageView with ImageView then it will work fine.

The issue has been fixed and will be updated in next release.

Nivs113 commented 3 years ago

HI @darshanbhanushali ,

Thank you sir, ok please mention on release note in next update, so it will help to us.

darshanbhanushali commented 3 years ago

Hi @Nivs113 ,

The above issue is fixed in the latest release. We have replaced ZoomImageView with ImageView component. We will suggest you please check with the latest UI Kit.