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

Santa Tracker - Moving to Android App Bundle

Chris Banes
February 19, 2019

Santa Tracker - Moving to Android App Bundle

Every year, Google releases the Santa Tracker app to millions of users across the world, wanting to track Santa over the holiday season. Chris will talk through how they managed to get the install APK from 60MB to 10MB, using Dynamic Feature Modules, asset compression and other things.

Chris Banes

February 19, 2019
Tweet

More Decks by Chris Banes

Other Decks in Technology

Transcript

  1. Moving to Android App Bundle
    Chris Banes
    @chrisbanes

    View Slide

  2. View Slide

  3. View Slide

  4. View Slide

  5. View Slide

  6. Goals for 2018
    ★ Convert more classes over to
    Kotlin (from 26%)
    ★ Bring our download size to 10MB
    ★ 2017’s APK was 60MB

    View Slide

  7. Android App Bundle
    Official Android app publishing format
    Average size savings of ~35%
    Enables dynamic features

    View Slide

  8. Deliver only what’s
    needed
    Languages
    Screen density Announced at I/O ‘18
    CPU architecture

    View Slide

  9. Base
    App Bundle

    View Slide

  10. Base
    xxxhdpi
    xxhdpi
    xhdpi
    hdpi
    mdpi
    ldpi
    App Bundle

    View Slide

  11. Base
    xxxhdpi
    xxhdpi
    xhdpi
    hdpi
    mdpi
    ldpi
    x86_64 arm64
    x86 arm
    App Bundle

    View Slide

  12. Base
    xxxhdpi
    xxhdpi
    xhdpi
    hdpi
    mdpi
    ldpi
    x86_64 arm64
    x86 arm
    pt
    fr
    en
    de
    zh ja
    App Bundle

    View Slide

  13. pt
    Base
    xxxhdpi
    xxhdpi
    xhdpi
    hdpi
    mdpi
    ldpi
    x86_64 arm64
    x86 arm
    fr
    en
    de
    zh ja
    Santa + Samsung Galaxy J5: en, arm, xhdpi

    View Slide

  14. Mrs Claus + Pixel: en & fr, arm64, 560dpi
    pt
    Base
    xxxhdpi
    xxhdpi
    xhdpi
    hdpi
    mdpi
    ldpi
    x86_64 arm64
    x86 arm
    fr
    en
    de
    zh ja

    View Slide

  15. Mrs Claus + Pixel: en & fr & pt, arm64, 560dpi
    pt
    Base
    xxxhdpi
    xxhdpi
    xhdpi
    hdpi
    mdpi
    ldpi
    x86_64 arm64
    x86 arm
    fr
    en
    de
    zh ja

    View Slide

  16. hdpi
    x86_64
    mdpi
    x86_64
    xhdpi
    x86_64
    xxhdpi
    x86_64
    ldpi
    x86_64
    xxxhdpi
    x86_64
    hdpi
    x86
    mdpi
    x86
    xhdpi
    x86
    xxhdpi
    x86
    ldpi
    x86
    xxxhdpi
    x86
    hdpi
    arm_64
    mdpi
    arm_64
    xhdpi
    arm_64
    xxhdpi
    arm_64
    ldpi
    arm_64
    xxxhdpi
    arm_64
    hdpi
    arm
    mdpi
    arm
    xhdpi
    arm
    xxhdpi
    arm
    ldpi
    arm
    xxxhdpi
    arm
    Galaxy Nexus: hdpi, arm. Pre-Lollipop

    View Slide

  17. APK
    APK
    Before After (M+)
    Compressed
    native libraries
    Wasted space!
    Uncompressed
    native libraries
    Uncompressed native librariesNew!

    View Slide

  18. ▼16%
    size on
    disk
    ▼8%
    download
    size
    Uncompressed native librariesNew!
    * On average

    View Slide

  19. Uploading an AAB saved us 20%
    Down to 48.5MB!
    Go try it!
    ./gradlew bundleRelease
    Dynamic delivery

    View Slide

  20. ➔ Allow you to split your app into
    separate downloadable modules
    Feature modules

    View Slide

  21. package="com.example.santatracker"
    split="elf_jetpack"
    ...>

    View Slide

  22. package="com.example.santatracker"
    split="elf_jetpack"
    ...>
    dist:title="@string/elf_jetpack_title">


    View Slide

  23. package="com.example.santatracker"
    split="elf_jetpack"
    ...>
    dist:title="@string/elf_jetpack_title"
    dist:onDemand="true">



    View Slide

  24. # Dynamic feature module, "elf_jetpack"
    apply plugin: 'com.android.dynamic-feature'
    android {...}
    dependencies {
    implementation project(':base')
    ...
    }

    View Slide

  25. # Base module: "base"
    apply plugin: 'com.android.application'
    android {
    dynamicFeatures = [':elf_jetpack']
    ...
    }

    View Slide

  26. Google Play
    Servers
    Play Core library
    Responsible for:
    ● Installing on-demand modules
    ● Managing modules

    View Slide

  27. ➔ First install == base install
    ➔ Each game == feature module
    Feature modules

    View Slide

  28. View Slide

  29. ➔ All of the game modules were
    coupled and messy
    ➔ Had to spend a lot of time
    breaking them apart
    ➔ Testing is difficult. Need to
    upload to Play Store to test
    What was hard?

    View Slide

  30. Internal test track
    Byte-for-byte what Play delivers
    Upload to Play Console and have
    it served immediately to your QA
    team.

    View Slide

  31. Wait for
    processing
    Internal test track
    Alpha and Beta tracks
    * After first upload

    View Slide

  32. View Slide

  33. For our final 2018 release...
    Results
    Base install:
    9.21 MB (from 60MB)
    In total, saved roughly:
    42 TB of storage and transfer

    View Slide

  34. 85%
    smaller than 2017

    View Slide

  35. For more information, we recently
    published a Medium article:
    medium.com/androiddevelopers
    Thanks!

    View Slide