-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Closed
Copy link
Labels
EngineeringInternalRequires API changes or must be handled by Expensify staffRequires API changes or must be handled by Expensify staffSmartScanWave5-free-submittersWave5-free-submittersWeeklyKSv2KSv2
Description
Problem
The Android app crashes due to a Canvas OOM exception when the image dimensions are extremely large. This has been fixed in the past, but we recently switched to Expo Image so I believe we'll need a new solution.
FATAL EXCEPTION: main
Process: com.expensify.chat, PID: 28882
java.lang.RuntimeException: Canvas: trying to draw too large(149730560bytes) bitmap.
at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:266)
at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:94)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:549)
at android.widget.ImageView.onDraw(ImageView.java:1446)
at expo.modules.image.ExpoImageView.onDraw(ExpoImageView.kt:204)
at android.view.View.draw(View.java:23900)
at expo.modules.image.ExpoImageView.draw(ExpoImageView.kt:200)
at android.view.View.updateDisplayListIfDirty(View.java:22767)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:4559)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4320)
at android.view.View.updateDisplayListIfDirty(View.java:22758)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:4559)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4320)
We have spent time on different image libraries and many related issues, and I am now trying to combine our current issues and resolve the remaining canvas OOM exception.
- Share a large image similar to this
- Attempt to view the image as either a receipt upload or a regular image attachment
Solution
Collect all past attempts, recent merged PRs, and determine the best path forward for resolving the crash:
- Here's where we merged Expo-Image
- Here was a prior attempt to fix the image in
react-native-fast-image - Another PR which attempted to fix the issue with an upstream react-native-fast-image PR
- We introduced AttachmentGallary as an improvement to image scaling and a replacement to
ImageZoom
Next question: Do we need a fix in Expo Image?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
EngineeringInternalRequires API changes or must be handled by Expensify staffRequires API changes or must be handled by Expensify staffSmartScanWave5-free-submittersWave5-free-submittersWeeklyKSv2KSv2