-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix : android crash when attaching a large size image #7209
Fix : android crash when attaching a large size image #7209
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
c107ecf
to
fcfea51
Compare
I have read the CLA Document and I hereby sign the CLA |
@ahmdshrif Could you please add videos for all platforms? Videos should cover Image zooming. Should be |
@@ -27,11 +27,14 @@ const propTypes = { | |||
/** | |||
* See https://github.com/react-native-image-picker/react-native-image-picker/#options | |||
* for ImagePicker configuration options | |||
* maxWidth and maxHeight to avoid android crash when with large images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add more details. What is the effect of adding these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add more details. What is the effect of adding these?
done,
@ahmdshrif Could you please add videos for all platforms? Videos should cover Image zooming. Also, please update the issue description.
Should be
$ https://github.com/Expensify/App/issues/6836
I update android and ios videos with zoom.
note I only change files with extension .native.js
so it only affects android and ios.
also, this issue is only on android.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the description is still wrong. The template must be saying to add only the link to the issue.
Could you please replace $ GH_LINK
with $ https://github.com/Expensify/App/issues/6836
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I change the link,
and describe the changes more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I tested it. But results are not favorable. During the proposal review, you said that image quality is not decreased but I see pixilated image. Although, it prevents app crashes but makes the feature literally unusable.
Can you please do some research and share that with us How did you end up deciding the resizing is necessary? I didn't get the answer to this question during the proposal review. We will try to find a solution together.
Also, If resizing is the only way. How can we do that without compromising the image quality? If we can't resize with the same quality, then what do you suggest as an alternative so that we can
- Prevent the crash.
- User is able to use the feature properly.
@parasharrajat I think @Jag96 is mentioning in review it's acceptable since it does not affect the small images.
|
Ok. Thanks for pointing. It's ok to have resizing. But may be there is a better alternative so that user can still interpret the information that he is sharing. |
i also get new solution which adding ss.mov |
@parasharrajat yes the new solution is working fine without any resizing if you agree I will push it now. |
@parasharrajat after debugging I find this error happens in react-native-pan-zoom . when I disable it I can use large images without any issue. after tracking the native error its comes from android canvas which is used in react-native-pan-zoom . so we have 2 solutions now : second : |
Thanks, @ahmdshrif. I will check about the usages of hardware acceleration. Although, it seems a small change it affects the whole app. This decision can't be taken alone. But we are getting close. Now you have traced the error to |
hi, @parasharrajat is this acceptable quality with resizing? |
That works. As said #7209 (comment), this is a big decision and it could affect performance badly. But I will give you a suggestion.
|
@parasharrajat |
I didn't get it. Could you please rephrase it? |
@parasharrajat it's just optimization for the previous resizing code. |
Ok. yeah, it looks good. Let me know when can I test. |
@parasharrajat I push the code. I just redefine the fixed number( maxWidth, maxHeight) by ratio, and again no document for that but the small screen crashes with small dimension numbers, and big screens crash with big numbers for image dimension. also, I get the image from the image picker with full quality and just resize it for image zoom View. I will add check to resize only if it's android. but what do u think about this? |
@ahmdshrif it looks like your commits are not signed, please see https://github.com/Expensify/App/blob/main/CONTRIBUTING.md#begin-coding-your-solution-in-a-pull-request and ensure your commits are signed. If you are unable to sign the commits in this PR please open a new one with signed commits. |
@ahmdshrif Could you please merge the main and test it to see if the app still crashes without your solution? It may be possible it is fixed based on QA team. |
@parasharrajat I test the main branch and App still crashes. |
Signed-off-by: AHMED <a.s1171111@gmail.com>
Signed-off-by: AHMED <a.s1171111@gmail.com>
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com> Signed-off-by: AHMED <a.s1171111@gmail.com>
Signed-off-by: AHMED <a.s1171111@gmail.com>
Signed-off-by: AHMED <a.s1171111@gmail.com>
Signed-off-by: AHMED <a.s1171111@gmail.com>
Signed-off-by: AHMED <a.s1171111@gmail.com>
096c979
to
cb2a618
Compare
@parasharrajat I rebase with main so you can test with and without my code. also, apply changes we discuss. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app no longer crashes, so it's technically a pass. But I am not seeing a preview on an older device (Nexus 5X). It shows a tiny zoomed-out version briefly, then disappears altogether., with the following native exception:
W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (580x19734, max=16384x16384)
Any suggestions for resolving this?
AndroidBitmapError.mp4
I think we should use FastImage and this issue should be resovled. This is already a dependency of the project. |
@Julesssss also, this pr solves the issue you talking about. we resize the image to the max size that the device can load. Screen_Recording_20220125-171257_New.Expensify.mp4 |
Ah okay, good point. I guess we should move the following suggestion into a new issue in that case. @parasharrajat, what do you think? Should your suggestion be separated?
|
Yeah, we can do that @Julesssss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the Bitmap too large exception was already occuring. As this PR solves the stated problem I'm going to merge.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @Julesssss in version: 1.1.32-1 🚀
|
🚀 Deployed to production by @roryabraham in version: 1.1.33-3 🚀
|
Details
Fixed Issues
$ #6836
Tests
QA Steps
1- Open app and login
2- Open any chat
3- Tap on + > Add Attachment > Choose from galery
4- Select a very long image
5- Wait a moment
6- Verify that app not crash
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Screen.Recording.2022-01-14.at.8.02.44.PM.mov
Android
Screen.Recording.2021-12-21.at.9.25.56.PM.mov