$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Boris Farber & Nikita Kozlov - The_Build_Side_o...
Search
droidcon Berlin
July 17, 2018
Programming
0
190
Boris Farber & Nikita Kozlov - The_Build_Side_of_Android_App
droidcon Berlin
July 17, 2018
Tweet
Share
More Decks by droidcon Berlin
See All by droidcon Berlin
Jon Markoff - Best practice for apps
droidcon_berlin_2018
0
190
Jon Markoff - Voice in the enterprise
droidcon_berlin_2018
0
65
Michael Jess - Enabling enterprise mobility with SAP
droidcon_berlin_2018
0
110
Ronen Sabag - Lean async code with Kotlin’s coroutines
droidcon_berlin_2018
0
68
Zan Markan - The state of Kotlin
droidcon_berlin_2018
0
74
Miquel Beltran - No More □ (tofu) Mastering Emoji on Android
droidcon_berlin_2018
0
130
Laurent Gasser & Jeremy Rochot - Sharing a success story - A low cost, Customer driven and co-developed Android EMM
droidcon_berlin_2018
0
280
Hoi Lam - Adding ML Kit to Android Things And some TensorFlow things
droidcon_berlin_2018
1
220
Nicola Corti - The curious case of Android button
droidcon_berlin_2018
0
65
Other Decks in Programming
See All in Programming
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
160
AIエージェントの設計で注意するべきポイント6選
har1101
5
2.1k
Vibe codingでおすすめの言語と開発手法
uyuki234
0
110
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
230
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 2
philipschwarz
PRO
0
110
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
530
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
3
1.1k
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
290
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
130
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.7k
Graviton と Nitro と私
maroon1st
0
130
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
2
250
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
27
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
88
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
210
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
170
Raft: Consensus for Rubyists
vanstee
141
7.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
230
Game over? The fight for quality and originality in the time of robots
wayneb77
1
66
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
37
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
170
Transcript
The Build Side of an Android App Nikita Kozlov Zalando
SE @Nikita_E_Kozlov Boris Farber Google @borisfarber
Background • Build improvement is the most requested feature from
developers • Worked with a few companies to speed up their builds • Share best practices and patterns
Problem • You add new features, libraries and frameworks. •
You refactor your code to smaller classes, add tests • Somehow, the build times add up
We don’t think about our build as a design component
Build challenge • Analysing build takes time • Difficult to
estimate and prioritize • Build improvement might be ambiguous
Focus on following • Build Tools versions • Hardware •
Modularization
Our process Create a test project Implement suggestion Test &
Measure Implement within a real project Android Studio Poet Gradle Profiler*
Incremental build change a Java/Kotlin file assembleDebug
Build Tools versions
Versions we tested • Gradle: 4.3.1 to 4.8 • Android
Gradle Plugin: from 3.0.1 to 3.1.2 • Kotlin: from 1.1.60 to 1.2.50
What about Build Tools versions? 2x speed up just from
the build tools
Another easy win From the build scan: • Compilation -
35% • Dexing - 55%
Dexing is a limiting step .CLASS .CLASS .CLASS .DEX .DEX
.DEX Will be faster if min SDK is 21 .CLASS
Incremental build with min SDK 21 Set min SDK to
21 during development to increase your build speed
Better Hardware
Hardware MacBook Pro 2015 • 13-inch • 2.7 GHz Intel
Core i5 • 16 GB 1867 MHz DDR3 MacBook Pro 2017 • 15-inch • 2,8 GHz Intel Core i7 • 16 GB 2133 MHz LPDDR3 vs
Hardware • Better hardware reduces build time significantly • Sometimes
even more than modularization
Background processes matters • Background processes reduces build time •
Antivirus made build speed 3 times slower
Modularization
Modularization - theory Module 2 Module 3 Module 1 App
Module App Module Key principles: 1. Parallelization 2. Caching 3. Compile avoidance
Compile Avoidance App Feature Incremental build after a change of
method’s body in Feature: 8s Incremental build after a adding a public method to Feature: 10s
Extracting rarely-changed code reduces build time App Incremental build with
a change in App: 55s Incremental build with a change in App: 39s App Utils
Work against tests whenever you can App Incremental build of
App with a change in App: 55s Incremental build of Utils module: 26s App Utils
Change in the library module vs application module App Utils
Incremental build of App module: 39s Incremental build of Utils module: 26s
Intermodule dependencies increase build time Incremental build with change in
Feature 3: 1m 5s Incremental build with change in Feature 3: 1m 11s Feature 1 Feature 3 Feature 2 App Feature 2 Feature 3 Feature 1 App
Start simple if you don’t have time App Tracking Utils
Core UI Networking App Feature Feature Feature Common code
Use a topology that works for you App App Monolith
Incremental build with change in App: 81s Incremental build with change in Main: 92s
Use a topology that works for you App Feature App
Monolith Feature Incremental build with change in Feature: 10s Incremental build with change in Feature: 7s
Modularization rules of thumb • Extract utils and other rarely-changed
code • Keep in mind the intermodule dependencies • Developing library modules in TDD way helps • Measure on a test project first
Our process Create a test project Implement suggestion Test &
Measure Implement within a real project Android Studio Poet Gradle Profiler
• Tool to generate large self contained Android projects •
https://github.com/android/android-studio-poet • Accepts JSON config file for the parameters Android Studio Poet
Features Java Butterknife Kotlin External Libraries Gradle Plugins Flavours Build
Types Intermodule dependencies Build Tools versioning String resources Images Layouts Activities Data Binding External repositories Dependency visualization Packages Classes Methods Fields
Two input formats Compact Full
Demo
Learn more • Extend Android Studio Poet - https://github.com/android/android-studio-poet/blob/master/exten d/Extending.md
• For this talk we made about 50 configs and more then 500 builds • Our configs, we used for this presentation https://github.com/android/android-studio-poet/tree/master/config s
Thanks ! And to Sergio Murguia, Google and Stefan Oehme,
Gradle
Questions ? Nikita Kozlov Zalando SE @Nikita_E_Kozlov Boris Farber Google
@borisfarber