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

Diving into Android App Bundles

Diving into Android App Bundles

Have you ever been concerned about your app size being unnecessarily large? Or you feel guilty that you ship features that are not useful to over 50% of your users? Android App Bundles is here to help you deliver better apps while still making your code base nicer. I will like to talk to you about it.

Omolara Adejuwon

August 09, 2019
Tweet

More Decks by Omolara Adejuwon

Other Decks in Technology

Transcript

  1. Diving Into Android App
    Bundles
    DROIDCON KENYA
    2019
    AUGUST 8TH-9TH, 2019

    View Slide

  2. DROIDCON KENYA
    2019 AUGUST 8TH-9TH, 2019
    @_larikraun
    Omolara Adejuwon
    Android Engineer at Kudi Inc.

    View Slide

  3. Storage Space
    Many phones have storage less than 1GB
    available space
    Your app + Photos +Videos + Chats + Other
    apps =

    View Slide

  4. Time
    Large Apps
    Slower downloads
    Frustrated Users

    View Slide

  5. Cost
    Many users live on capped data.
    The larger the app, the less willing people
    are to download

    View Slide

  6. Key Insights
    1%
    3MB
    =

    View Slide

  7. ANALYZING APK
    classes.dex
    classes2.dex
    assets/
    res/
    AndroidManifest.xml

    View Slide

  8. Screen density
    xxxhdpi xxhdpi xhdpi
    hdpi mdpi ldpi
    Architecture
    arm64 x86 arm
    x86_64
    Locale
    en xh db
    ja ... ...

    View Slide

  9. Android App Bundles

    View Slide

  10. Replaces the traditional monolithic apk

    View Slide

  11. Single artifact with all of your app's code and
    resources

    View Slide

  12. Play generates the apk optimized for specific devices.
    Therefore, AABs are not installable directly.

    View Slide

  13. 20%
    average size saving vs
    universal APK
    11%
    increase in installs due
    to size savings

    View Slide

  14. 7.2%
    saved in App Size
    At Kudi

    View Slide

  15. ANALYZING AAB
    base/
    dex/
    classes.dex
    classes2.dex
    assets/
    res/
    manifest/
    AndroidManifest.xml

    View Slide

  16. Dynamic Feature
    Modules

    View Slide

  17. View Slide

  18. View Slide

  19. View Slide

  20. AndroidManifest.xml

    View Slide

  21. droidconke/
    dex/
    classes.dex
    assets/
    res/
    manifest/
    AndroidManifest.xml
    base/
    dex/
    classes.dex
    classes2.dex
    assets/
    res/
    manifest/
    AndroidManifest.xml
    Base Module
    Dynamic Feature Module -
    droidconke

    View Slide

  22. Dynamic Delivery

    View Slide

  23. The smaller APKs are achieved by delivering only the
    resources the specific devices need.

    View Slide

  24. It works with Split APKs as the underlying principle

    View Slide

  25. Split APKs
    Base APK: contains all common code and resources
    Configuration APKs: contains resources based on device’s
    config i.e locale, architecture, screen density
    Dynamic Feature APKs: contains codes that can be
    downloaded at a later time. This will be discussed later in
    the presentation.
    - Introduced in Lollipop

    View Slide

  26. Screen density
    xxxhdpi xxhdpi xhdpi hdpi
    mdpi ldpi
    Architecture
    arm64 x86 arm x86_64
    Locale
    en xh db ja
    fr ...

    View Slide

  27. Screen density
    xxhdpi xhdpi hdpi
    mdpi ldpi
    Architecture
    arm64 x86 arm x86_64
    Locale
    en xh db ja
    fr ...
    xxxhdpi

    View Slide

  28. Screen density
    xxhdpi xhdpi hdpi
    mdpi ldpi
    Architecture
    x86 arm x86_64
    Locale
    en xh db ja
    fr ...
    arm64
    xxxhdpi

    View Slide

  29. Screen density
    xxhdpi xhdpi hdpi
    mdpi ldpi
    Architecture
    x86 arm x86_64
    Locale
    xh db ja
    ...
    fr
    arm64
    xxxhdpi

    View Slide

  30. In-App Updates

    View Slide

  31. Play Core library feature that introduces a new request flow to
    prompt active users to update your app

    View Slide

  32. Works only with devices running Android 5.0 (API level 21) or
    higher,

    View Slide

  33. A user experience that provides background download and
    installation with graceful state monitoring.
    This UX is appropriate when it’s acceptable for the user to use
    the app while downloading the update.
    Flexible In-App Updates

    View Slide

  34. View Slide

  35. A full screen user experience that requires the user to update
    and restart the app in order to continue using the app.
    Immediate In-App Updates

    View Slide

  36. This UX is best for cases where an update is critical for
    continued use of the app.
    After a user accepts an immediate update, Google Play handles
    the update installation and app restart.
    Immediate In-App Updates

    View Slide

  37. View Slide

  38. View Slide

  39. Is update available?

    View Slide

  40. Start the update

    View Slide

  41. Start the update

    View Slide

  42. For flexible updates, you need to handle the app installation
    yourself after the download is complete.
    Flexible Vs. Immediate In-App Updates
    For immediate updates, play handles the download and
    installation for you.

    View Slide

  43. Install the downloaded updated

    View Slide

  44. Conditional Delivery

    View Slide

  45. Let's you control which part of your app is served to which users

    View Slide

  46. You can specify conditions under which a feature would be
    delivered as part of the app installation or otherwise left out.

    View Slide

  47. Types of Conditions
    Country
    MinSdk Version
    Device Feature

    View Slide

  48. View Slide

  49. On-Demand Delivery

    View Slide

  50. Let's you install and uninstall specific features in on-demand

    View Slide

  51. View Slide

  52. AndroidManifest.xml

    View Slide

  53. View Slide

  54. View Slide

  55. View Slide

  56. To be able to maximize all the cool features of Android App
    Bundles as explained so far, your app needs to be well
    modularized.
    Moyinoluwa Adeyemi just delivered a great talk on App
    Modularization: From Zero to Hero

    View Slide

  57. Testing Android App
    Bundles

    View Slide

  58. Unlike APKs, AABs are not installable directly because
    play generates the apk optimized for specific devices

    View Slide

  59. Internal App Sharing

    View Slide

  60. Internal App Sharing gives you a quick and easy way
    to share Android App Bundle and Apk Internally

    View Slide

  61. It lets you upload app bundle or APK and share the link
    with your team.

    View Slide

  62. No signed APK or App bundle is required for Internal app sharing.

    View Slide

  63. No Unique Version code enforcement. So multiple APK or App
    bundles can be upload independently, to the play console.

    View Slide

  64. You can also debug the APK or App bundles once they’re
    installed to the tester’s device by uploading Debuggable
    artifacts.

    View Slide

  65. There are APIs available for Internal App sharing so you can
    automate some of the processes

    View Slide

  66. View Slide

  67. Image Credit: https://medium.com/mindorks/internal-app-sharing-in-android-f80c7751bf37

    View Slide

  68. A Challenge we faced at Kudi

    View Slide

  69. View Slide

  70. View Slide

  71. https://developer.android.com/studio/projects/dynamic-delivery
    https://developer.android.com/studio/command-line/bundletool
    https://events.google.com/io/schedule/?section=may-8&sid=b9eabde0-be05-
    492c-bf9e-c3f772f1db7e
    https://codelabs.developers.google.com/codelabs/your-first-dynamic-
    app/index.html
    Useful Links

    View Slide

  72. Thank you for listening
    @_larikraun
    Omolara Adejuwon

    View Slide