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

2018-05-22-android-app-bundle

AAkira
May 22, 2018

 2018-05-22-android-app-bundle

CA.apk Google I/O 報告会
Android App Bundle
https://cyberagent.connpass.com/event/84233/

AAkira

May 22, 2018
Tweet

More Decks by AAkira

Other Decks in Technology

Transcript

  1. Android App Bundle
    @_a_akira
    CA.aab (apk) Google I/O 2018報告会

    View full-size slide

  2. About me
    @_a_akira
    AAkira
    CyberAgent, Inc. FRESH!
    Akira Aratani

    View full-size slide

  3. Agenda
    • About Android App Bundle
    • App Bundle
    • Dynamic Delivery
    • Develop Android App Bundle
    • Upload .aab file to PlayStore
    • bundle tool
    • Summary

    View full-size slide

  4. About Android App Bundle

    View full-size slide

  5. https://www.youtube.com/watch?v=flU42CTF3MQ
    Google I/O 2018 Developer keynote (0:09:00頃)

    View full-size slide

  6. Innovative distribution

    View full-size slide

  7. 1% down per 6MB

    View full-size slide

  8. Android App Bundle
    10PB saved per day

    View full-size slide

  9. Android App Bundle
    .aab ≠ .apk

    View full-size slide

  10. Android App Bundle

    View full-size slide

  11. Android App Bundle
    arm 64 bit
    Lang : US
    hdpi
    x86 arm
    xxhdpi xhdpi dpi
    Lang : JA Lang : PL Lang : IT Lang : IS
    Lang : FR Lang : DE Lang : ES Lang : NL Lang : TR

    View full-size slide

  12. Android App Bundle
    arm 64 bit
    Lang : US
    hdpi
    x86 arm
    xxhdpi xhdpi dpi
    Lang : JA Lang : PL Lang : IT Lang : IS
    Lang : FR Lang : DE Lang : ES Lang : NL Lang : TR

    View full-size slide

  13. Android App Bundle
    arm 64 bit
    Lang : US
    hdpi
    x86
    arm
    xxhdpi
    xhdpi dpi
    Lang : JA
    Lang : PL Lang : IT
    Lang : IS
    Lang : FR Lang : DE
    Lang : ES Lang : NL
    Lang : TR
    arm 64 bit
    Lang : US
    hdpi
    x86 arm
    xxhdpi xhdpi dpi
    Lang : JA Lang : PL Lang : IT Lang : IS
    Lang : FR Lang : DE Lang : ES Lang : NL Lang : TR
    全てのリソースを
    端末にインストール

    View full-size slide

  14. Android App Bundle
    arm 64 bit
    Lang : US
    hdpi
    x86 arm
    xxhdpi xhdpi dpi
    Lang : JA Lang : PL Lang : IT Lang : IS
    Lang : FR Lang : DE Lang : ES Lang : NL Lang : TR

    View full-size slide

  15. Android App Bundle
    hdpi
    x86 arm
    arm 64 bit
    Lang : US
    xxhdpi xhdpi dpi
    Lang : JA Lang : PL Lang : IT Lang : IS
    Lang : FR Lang : DE Lang : ES Lang : NL Lang : TR
    arm 64 bit
    Lang : US
    xxhdpi
    必要なリソースのみを
    端末にインストール

    View full-size slide

  16. Android App Bundle

    View full-size slide

  17. Android App Bundle
    FRESH!
    35.8%
    saving

    View full-size slide

  18. Dynamic Delivery

    View full-size slide

  19. Dynamic Delivery
    Sell
    Browse
    Buy
    e-commerce app

    View full-size slide

  20. Dynamic Delivery
    Sell
    Browse
    Buy
    e-commerce app
    Browse
    Buy
    初回DLでは必要な部分だけ

    View full-size slide

  21. Dynamic Delivery
    Browse
    Buy
    Sell
    Browse
    Buy
    Sell
    e-commerce app
    必要な時に新しくDL

    View full-size slide

  22. Dynamic Delivery

    View full-size slide

  23. Dynamic Delivery
    • 後からfeature moduleをDL可能
    • コードpush的な使い方は出来ない

    (各feature moduleのversion codeは合わせる必要ある)
    • moduleを選択出来るのでA/Bテストみたいな使い方も出来そう

    View full-size slide

  24. Develop

    Android App Bundle

    View full-size slide

  25. Environment

    dependencies {
    classpath “com.android.tools.build:gradle:3.2.0-alpha14”
    }

    View full-size slide

  26. Build App Bundle

    View full-size slide

  27. Build App Bundle

    $ ./gradlew [module]:bundleVariant
    e.g.

    ./gradlew bundleDevRelease

    View full-size slide

  28. Build App Bundle

    module/build/outputs/bundleVariant/bundle.aab

    View full-size slide

  29. Publish bundle.aab

    View full-size slide

  30. Publish bundle.aab

    View full-size slide

  31. Prepare keystore

    $ java -jar pepk.jar \

    --keystore=[your keystore] \
    --alias=[keystore alias] \

    --output=[encrypted_private_key] \

    --encryptionkey=[hogehogehoge]

    View full-size slide


  32. $ java -jar pepk.jar \

    --keystore=[your keystore] \
    --alias=[keystore alias] \

    --output=[encrypted_private_key] \

    --encryptionkey=[hogehogehoge]
    Prepare keystore
    storeからDL

    View full-size slide


  33. $ java -jar pepk.jar \

    --keystore=[your keystore] \
    --alias=[keystore alias] \

    --output=[encrypted_private_key] \

    --encryptionkey=[hogehogehoge]
    Prepare keystore
    既存のkeystoreを指定

    View full-size slide


  34. $ java -jar pepk.jar \

    --keystore=[your keystore] \
    --alias=[keystore alias] \

    --output=[encrypted_private_key] \

    --encryptionkey=[hogehogehoge]
    Prepare keystore
    keystoreのaliasを指定

    View full-size slide


  35. $ java -jar pepk.jar \

    --keystore=[your keystore] \
    --alias=[keystore alias] \

    --output=[encrypted_private_key] \

    --encryptionkey=[hogehogehoge]
    Prepare keystore
    任意のファイル名

    View full-size slide


  36. $ java -jar pepk.jar \

    --keystore=[your keystore] \
    --alias=[keystore alias] \

    --output=[encrypted_private_key] \

    --encryptionkey=[hogehogehoge]
    Prepare keystore
    storeに表示されているkeyを指定

    View full-size slide

  37. Publish bundle.aab

    View full-size slide

  38. bundle tool
    google/bundletool
    https://github.com/google/bundletool

    View full-size slide

  39. bundle tool

    $ bundletool build-apks \

    --bundle= \
    --output=


    View full-size slide

  40. bundle tool
    $ mkdir apks

    $ unzip out.apks -d apks

    View full-size slide

  41. bundle tool
    $ ls
    base-hdpi.apk
    base-master.apk
    base-tvdpi.apk
    base-xxhdpi.apk
    standalone-hdpi.apk
    standalone-mdpi.apk
    standalone-xhdpi.apk
    standalone-xxxhdpi.apk
    base-ldpi.apk
    base-mdpi.apk
    base-xhdpi.apk
    base-xxxhdpi.apk
    standalone-ldpi.apk
    standalone-tvdpi.apk
    standalone-xxhdpi.apk
    toc.pb

    View full-size slide

  42. bundle tool
    $ bundletool get-device-spec \

    --output= \
    接続端末の情報を出力

    View full-size slide

  43. bundle tool
    $ bundletool get-device-spec \

    --output= \
    {
    "supportedAbis": ["arm64-v8a", "armeabi-v7a"],
    "supportedLocales": ["en-US"],
    "screenDensity": 640,
    "sdkVersion": 27
    } Pixel2.json

    View full-size slide

  44. bundle tool
    $ bundletool extract-apks \

    --apks= \
    --output-dir= \
    --device-spec=pixel2.json

    View full-size slide

  45. bundle tool
    $ bundletool extract-apks \

    --apks= \
    --output-dir= \
    --device-spec=pixel2.json

    View full-size slide

  46. bundle tool
    $ bundletool extract-apks \

    --apks= \
    --output-dir= \
    --device-spec=pixel2.json

    View full-size slide

  47. bundle tool
    $ bundletool extract-apks \

    --apks= \
    --output-dir= \
    --device-spec=pixel2.json

    View full-size slide

  48. bundle tool
    $ ls
    base-master.apk
    base-xxxhdpi.apk

    base-arm64_v8.apk
    base-en.apk

    View full-size slide

  49. bundle tool
    android {
    splits {
    language {
    enable true
    include "en", "ja"
    }
    density {
    enable true
    }
    abi {
    enable true
    }
    }
    }

    View full-size slide

  50. bundle tool
    android {
    splits {
    language {
    enable true
    include "en", "ja"
    }
    density {
    enable true
    }
    abi {
    enable true
    }
    }
    }
    言語ファイルの分割

    View full-size slide

  51. bundle tool
    android {
    splits {
    language {
    enable true
    include "en", "ja"
    }
    density {
    enable true
    }
    abi {
    enable true
    }
    }
    }
    画面サイズの分割

    View full-size slide

  52. bundle tool
    android {
    splits {
    language {
    enable true
    include "en", "ja"
    }
    density {
    enable true
    }
    abi {
    enable true
    }
    }
    }
    CPU命令セットの分割

    View full-size slide

  53. bundle tool
    android {
    splits {
    language {
    enable true
    include "en", "ja"
    }
    density {
    enable true
    }
    abi {
    enable false
    }
    }
    }
    分割不要ならfalse

    View full-size slide

  54. bundle tool
    android {
    generatePureSplits true
    splits {
    language {
    enable true
    include "en", "ja"
    }
    density {
    enable true
    }
    abi {
    enable true
    }
    }
    }

    View full-size slide

  55. bundle tool
    android {
    generatePureSplits true
    splits {
    language {
    enable true
    include "en", "ja"
    }
    ɹɹ…
    multi apk, instant appsで使われてる

    View full-size slide

  56. bundle tool
    android {
    generatePureSplits true
    splits {
    language {
    enable true
    include "en", "ja"
    }
    ɹɹ…
    min SDK21以上
    multi apk, instant appsで使われてる

    View full-size slide

  57. bundle tool
    通常のbuildで分割される (↑instant apps)

    View full-size slide

  58. bundle tool
    applicationはフォルダ内で分割されて出力

    View full-size slide

  59. Sample Project
    AAkira/DaggerInstantApps
    https://goo.gl/7xqb5M
    既存アプリへのInstantApps導入

    @DroidKaigi2018
    https://goo.gl/b7kHhf

    View full-size slide

  60. Instant Apps
    10MBまで配布可能に!
    https://g.co/instantapps/10mb

    View full-size slide

  61. YouTube Links
    https://youtu.be/
    9D63S4ZRBls
    https://youtu.be/
    httqEshs_Bk
    https://youtu.be/
    0raqVydJmNE
    https://youtu.be/
    bViNOUeFuiQ

    View full-size slide

  62. Summary
    • App Bundleの対応は凄く簡単なので、

    次のリリースからすぐに対応可能
    • Dynamic Deliveryはコードpushではない
    • これからのアプリはmodule化が必須
    • 今後InstantApps, Dynamic Deliveryはデフォルト構成に

    View full-size slide

  63. Summary
    Googlerと話したほうが良い


    2日目のSandboxで2時間

    3日目のOffice Hourで2時間

    View full-size slide

  64. @_a_akira
    AAkira
    Thanks

    View full-size slide