Optimizing Configuration Time for Android Apps that Use React Native
Article Summary
Swiggy's Android team was losing 1+ minute on every single build. For a team generating 55 builds daily, that's death by a thousand paper cuts.
Balvinder Gambhir from Swiggy's engineering team diagnosed why adding React Native to their super app caused Gradle configuration times to skyrocket. The culprit? A native_modules.gradle script executing expensive node commands on every build.
Key Takeaways
- Configuration time jumped from seconds to 1m 26s after adding React Native
- 86% of time spent executing native_modules.gradle script repeatedly
- Caching node config command output slashed configuration to 12 seconds
- Team now saves 1 hour per day across 55 daily builds
- Solution uses patch-package to ensure consistent script across all developers
Critical Insight
By caching the output of expensive node commands in the React Native build process, Swiggy reduced Gradle configuration time by 86% (from 1m 26s to 12s).