Skip to content
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

Android build times are very slow #25501

Closed
AndrewGable opened this issue Aug 18, 2023 · 5 comments
Closed

Android build times are very slow #25501

AndrewGable opened this issue Aug 18, 2023 · 5 comments
Assignees
Labels
Engineering Improvement Item broken or needs improvement. Weekly KSv2

Comments

@AndrewGable
Copy link
Contributor

Problem

If you run npm run android the build time is very very slow. This is because we are required to build React Native from source to support two patches:

We have two patch files which implement/fix things on Android side, NumberOfLines.patch and VerticalScrollBarPosition.patch. When we have Android patches, it’s necessary to build from source to ensure these patches take effect in the application.

NumberOfLines.patch
Related to these PRs: facebook/react-native#35703 and facebook/react-native#38021
It’s necessary to fix this issue: #19809

VerticalScrollBarPosition.patch
Related to these PRs: facebook/react-native#38071 and facebook/react-native#38073
It’s necessary to fix this issue: #11321

VerticalScrollBarPosition.patch is merged and are available in RN 0.72.4 🎉 -> https://github.com/facebook/react-native/blob/main/CHANGELOG.md#v0724. Once we update to this version or higher we can remove this patch.

Here’s more info about all the PRs we have and current state: #18507 (comment)

Solution

  1. Get NumberOfLines.patch merged and deployed
  2. Update to a version of React Native containing both patches which prevents needing from building from source.
@AndrewGable AndrewGable added Engineering Weekly KSv2 Improvement Item broken or needs improvement. labels Aug 18, 2023
@AndrewGable AndrewGable self-assigned this Aug 18, 2023
@AndrewGable
Copy link
Contributor Author

In contact with @Szymon20000 on his upstream PRs, we are specifically targeting this iOS PR for numberOfLines prop first: facebook/react-native#38021

Then will be opening a new PR for Android fixes for numberOfLines. Once both of these PRs are merged we should be able to update to the version that includes these PRs.

@melvin-bot melvin-bot bot added the Overdue label Aug 28, 2023
@AndrewGable
Copy link
Contributor Author

We decreased this down to ~5 minutes and sped up the build by 3x with this PR: #25757

We will continue to look into the patches, but for now Android seems to be at an acceptable build time.

@melvin-bot melvin-bot bot removed the Overdue label Sep 8, 2023
@jamonholmgren
Copy link

@AndrewGable Could you build custom 3rd party native components that have this behavior rather than building the whole RN from source? (I haven't looked in depth at this yet, but that's the first thing that comes to mind for me.)

@jamonholmgren
Copy link

FYI, facebook/react-native#38021 won't be merged, per core team.

@AndrewGable
Copy link
Contributor Author

We've been discussing alternatives internally, we will keep you updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering Improvement Item broken or needs improvement. Weekly KSv2
Projects
None yet
Development

No branches or pull requests

2 participants