After Duplo modularization, we noticed that the task producing a transitive R class was taking a significant amount of time to execute. To eliminate this task altogether, and since the non-transitive R class is advertised to have up to 40% incremental build time improvement, we decided to migrate our codebase to use it. If you’re not…
Overview
The article discusses the migration to a non-transitive R class in Android development, detailing the process, benefits, and challenges faced by the Slack engineering team. It highlights the improvements in build times and APK size, along with the conventions established for resource referencing.
What You'll Learn
How to migrate to non-transitive R class in an Android project
Why non-transitive R class improves build times and APK size
How to establish conventions for resource referencing in Kotlin and Java
Prerequisites & Requirements
- Understanding of Android development and Gradle
- Familiarity with Android Studio
Key Questions Answered
What is the non-transitive R class in Android development?
What benefits were observed after migrating to non-transitive R class?
How did Slack enforce conventions for resource referencing?
What challenges did Slack face during the migration process?
Key Statistics & Figures
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Key Actionable Insights
1Implement import aliases for resource referencing in Kotlin to simplify code and improve readability.Using import aliases can reduce verbosity and make it easier for developers to reference resources without needing to use fully-qualified names, enhancing code maintainability.
2Utilize lint checks to enforce coding conventions related to resource imports.By implementing lint checks, teams can automatically identify and correct deviations from established conventions, ensuring consistency across the codebase and reducing potential errors.
3Monitor build performance metrics after migrating to non-transitive R class to quantify improvements.Tracking build times and APK sizes post-migration can help teams assess the effectiveness of their transition and identify further optimization opportunities.