Skip to content

[AWAITING OFFER ACCEPTANCE] [$250] Speed up Android builds #49567

Closed

Description

@roryabraham

Problem

Android builds typically take 10-30 minutes on my M2 Mac, which is a long time.

Solution

Research ways to speed them up

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021856375406194339171
  • Upwork Job ID: 1856375406194339171
  • Last Price Increase: 2024-11-12
  • Automatic offers:
    • aimane-chnaif | Contributor | 104865138
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. self-assigned this
    on Sep 21, 2024
  2. changed the title [-]Try to speed up Android builds[/-] [+]Speed up Android builds[/+] on Sep 21, 2024
  3. roryabraham commented on Sep 21, 2024

    @roryabraham
    ContributorAuthor

    There are a few things I'd like to try:

    • Enable gradle build cache
    • Enable gradle configuration cache
    • Enable gradle parallel task execution
    • Enable ccache
  4. roryabraham commented on Sep 21, 2024

    @roryabraham
    ContributorAuthor

    In order to be methodic and quantitative with these changes, I'll be using ./gradlew build --scan to generate detailed build scan reports.

  5. saifelance commented on Sep 21, 2024

    @saifelance
  6. roryabraham commented on Sep 21, 2024

    @roryabraham
    Author
  7. roryabraham commented on Sep 21, 2024

    @roryabraham
    ContributorAuthor

    Build scan for a clean ./gradlew assembleDebug (note: next time I should do active arch only, because that's what we do in dev)

    https://scans.gradle.com/s/4e4x4kl55d3js

  8. roryabraham commented on Sep 21, 2024

    @roryabraham
    ContributorAuthor

    Another clean build scan, this time only one arch: https://scans.gradle.com/s/4apezfw7xtotm

    Build command was: ./gradlew assembleDebug -PreactNativeArchitectures=arm64-v8a --scan

  9. roryabraham commented on Sep 21, 2024

    @roryabraham
    ContributorAuthor

    A build scan with only this diff:

    diff --git a/android/gradle.properties b/android/gradle.properties
    index 87333d20f74..1f60a7d335d 100644
    --- a/android/gradle.properties
    +++ b/android/gradle.properties
    @@ -55,3 +55,6 @@ MYAPP_UPLOAD_KEY_ALIAS=ReactNativeChat-Key-Alias
     disableFrameProcessors=true
     
     android.nonTransitiveRClass=false
    +
    +org.gradle.parallel=true

    https://scans.gradle.com/s/67qe4vuqgytyq

  10. roryabraham commented on Sep 25, 2024

    @roryabraham
    ContributorAuthor

    Adding the org.gradle.caching=true does not appear to be worth it, because:

    • It has no effect on the configuration phase, which consistently takes about 10 minutes while the build phase takes about 1 minute w/ parallel enabled.
    • Even a cached build seemed to take about a minute, but populating the cache takes longer
  11. roryabraham commented on Sep 25, 2024

    @roryabraham
    ContributorAuthor

    Going to try the configuration cache field with:

    ./gradlew assembleDebug --configuration-cache -PreactNativeArchitectures=arm64-v8a --scan

    Edit: 2nd build w/ configuration cache enabled failed 😞

    Logs
    FAILURE: Build failed with an exception.
    
    * Where:
    Settings file '/Users/roryabraham/Expensidev/App/android/settings.gradle' line: 3
    
    * What went wrong:
    Configuration cache problems found in this build.
    
    9752 problems were found storing the configuration cache, only the first 4096 were considered, 7 of which seem unique.
    - Build file '../node_modules/@expensify/react-native-live-markdown/android/build.gradle': external process started 'node --print require.resolve('react-native/package.json')'
      See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
    - Build file 'app/build.gradle': external process started 'node --print require.resolve('@expo/cli')'
      See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
    - Build file 'app/build.gradle': external process started 'node -e require('expo/scripts/resolveAppEntry') /Users/roryabraham/Expensidev/App android absolute'
      See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
    - Build file 'build.gradle': external process started 'node --print JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version'
      See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
    - Build file 'build.gradle': line 47: external process started 'node --print JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version'
      See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
    - Settings file 'settings.gradle': line 26: external process started 'node --print require.resolve('expo/package.json')'
      See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
    - Settings file 'settings.gradle': line 3: external process started 'npx @react-native-community/cli config'
      See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
    
  12. 96 remaining items

  13. Julesssss commented on Feb 10, 2025

    @Julesssss
    Contributor

    Let's reopen if any further ideas are shared.

  14. eVoloshchak commented on Feb 28, 2025

    @eVoloshchak
    Contributor

    @Julesssss, sorry for coming back to this so late. I just realized I never requested the payment for review on #50206. Would you mind posting a payment summary here? Thanks!

  15. eVoloshchak commented on Mar 6, 2025

    @eVoloshchak
    Contributor

    @garrettmknight, could you post a payment summary for this? Thank you!

  16. garrettmknight commented on Mar 7, 2025

    @garrettmknight
    Contributor

    Payment Summary:

  17. mallenexpensify commented on Nov 11, 2025

    @mallenexpensify
    Contributor

    @aimane-chnaif can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~021988044315731516714

  18. mallenexpensify commented on Nov 11, 2025

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @aimane-chnaif paid $250 via Upwork

  19. trjExpensify commented on Dec 23, 2025

    @trjExpensify
    Contributor

    approved $250 for @eVoloshchak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions