-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
perf: reduce APK size with ProGuard enabled #34218
perf: reduce APK size with ProGuard enabled #34218
Conversation
It would be ideal to NOT MERGE this PR until the QA completes their testing and confirms that no crashes or loss of functionality is noticed. We can move forward with creating the builds for this PR and kick off the QA testing. |
Running a build here https://github.com/Expensify/App/actions/runs/7474984009 |
This comment has been minimized.
This comment has been minimized.
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.
Testing well for me, though we'll need to keep a close eye out for regressions once this is merged as it removes and obfuscates code.
@shubham1206agra will do some initial testing and we would probably ask QA to do a full regression on the android build before merging too |
1 similar comment
@shubham1206agra will do some initial testing and we would probably ask QA to do a full regression on the android build before merging too |
Is it the logo? that might be case for other adhoc builds too, that would be good to check |
I think the App is working fine. Except the logo, crossed check with other adhoc build where it works fine. Edit - One think I noticed is that the message does not scroll to bottom at all. |
XRecorder_10012024_184612_compressed.mp4 |
@hurali97 Please address this #34218 (comment) |
@shubham1206agra did you confirm that does not happen on other Android adhoc builds? |
Yes |
@shubham1206agra It's fixed now. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeXRecorder_10012024_184612_compressed.mp4Android: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
@hurali97 Can you confirm the final size of apk now? |
Yeah sure. After adding keep rules for resources:
There's 0.1 MB increase in Download Size and APK Size remains intact. We still save 10.3 MB in Download size. |
<resources xmlns:tools="http://schemas.android.com/tools" | ||
tools:keep="@mipmap/ic_launcher, @drawable/bootsplash*, @drawable/alert_background, | ||
@drawable/ic_launcher*, @drawable/ic_notification*, @drawable/picker_background, | ||
@drawable/rn_edit_text_material" /> |
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.
This is a small selection of resources, did we get this list from anywhere specific?
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 inspected the res directory and all the resources that were used in the codebase by search, were added in keep rule. For example, drawable/datepicker_background.xml
wasn't being referenced anywhere, so I didn't add it to the keep rule.
So there's no prescription that says what to keep but anything that's referenced and is being used can be kept. I also tested on build variants like production and adhoc and I get the correct assets as our keep xml file is inherited for each build variant.
https://developer.android.com/build/shrink-code#keep-resources
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.
Resources in react-native/assets
aren't touched by resource shrinker, so that's why they aren't added in the keep rules.
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 also tested on build variants like production and adhoc and I get the correct assets as our keep xml file is inherited for each build variant.
Okay cool, that's what I was worried about as it's not clear that alternative resourses would be kept. For example: drawable-xxxhdpi/bootsplash_logo.png
I'm just generating another test build to confirm that we're not defaulting to the lower res drawables.
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.
LGTM!
We did not find an internal engineer to review this PR, trying to assign a random engineer to #34222 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
Making a new test build |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
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.
LGTM, was unable to find any broken features
Oh wait, did we confirm the logo issue doesn't exist on other AdHoc builds?
|
I have checked this. Works fine for me. |
@Julesssss I have that on my iPhone adhoc build, other one too, not related |
I think this is good to go then! |
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.
Ah why is this still not merged... going to merge it
✋ 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 https://github.com/mountiny in version: 1.4.33-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.4.33-5 🚀
|
Details
This PR enables minification and resource shrinking for android using ProGuard. This gives us 10.4 MB reduction in Download Size.
Before:
After:
Fixed Issues
$ #34222
PROPOSAL: #33070 (comment)
Tests
Install the APK
Launch the app and use normally
The app shouldn't crash and shouldn't miss any functionality
Verify that no errors appear in the JS console
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-01-10.at.4.44.02.PM.mov
Android: mWeb Chrome
N/A
iOS: Native
N/A
iOS: mWeb Safari
N/A
MacOS: Chrome / Safari
N/A
MacOS: Desktop
N/A