Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Faster Builds on Android

Faster Builds on Android

I talk about the importance of faster builds and share tips to speed them up with Gradle and modularisation. Doing it right, you can change code in the business logic and run the tests for it in 2 seconds instead of 2 minutes.

Philipp Hofmann

November 06, 2018
Tweet

More Decks by Philipp Hofmann

Other Decks in Programming

Transcript

  1. Scenario • 10 - 100 builds per day • Reduce

    build time by 118s • Save around 20 min to 2 hours per day • Save around 1,6 hours to 10 hours per week
  2. Scenario • Reduce by 5 seconds • 20 builds *

    5s * 10 devs * 5 working days = 1,4 hours
  3. • Basic tips to tweak your builds • Modularisation •

    Gradle Build Scans • Some additional information about the topic on the chart • Maybe some numbers or a background information about some insights • Here is just another placeholder text to visualise the look of a filled info box INFO BOX Agenda • Basic Android knowledge appreciated • Tips for beginners • Example for experts to maybe learn something new INFO
  4. Minimise the repository count. repositories { google() maven { url

    '../localmaven' } maven { url 'https://maven.fabric.io/public' } mavenCentral() jcenter() maven { url "https://jitpack.io" } flatDir { dirs 'libs' } }
  5. If neither a task’s inputs nor its output have changed

    since the last time it was run, Gradle will not run it again.
  6. flavorDimensions "mode" productFlavors { dev { dimension "mode" resConfigs "en",

    "xxhdpi" versionNameSuffix "-dev" applicationIdSuffix '.dev' signingConfig signingConfigs.debug buildConfigField "long", "TIMESTAMP", "0L" } full { dimension "mode" } }
  7. Advantages of multiple modules • For big projects huge speed

    up, if done right. • Add smaller test app of a specific feature for very fast iterations. • Build and test them in parallel on CI. • Force developers to have a clear separation of concerns. • And all the other advantages … (Reusability, Maintainability, SOLID, …)
  8. 2015 2016 2017 2018 LOC in repo LOC NOT in

    the monolith LOC in the monolith
  9. :app :features :common :libs :http :logger :audio :video :artist :search

    :ui :library :feed :profile :radio :radio :android :ui-tools :follow :share :mobius :dep-inj
  10. ./gradlew assembleDebug --scan BUILD SUCCESSFUL in 6s Do you accept

    the Gradle Cloud Services license agreement (https:// gradle.com/terms-of-service)? [yes, no] yes Gradle Cloud Services license agreement accepted. Publishing build scan... https://gradle.com/s/czajmbyg73t62