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 Slide

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

    View Slide

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

    View Slide

  4. About Android App Bundle

    View Slide

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

    View Slide

  6. Innovative distribution

    View Slide

  7. View Slide

  8. 1% down per 6MB

    View Slide

  9. Android App Bundle
    10PB saved per day

    View Slide

  10. Android App Bundle
    .aab ≠ .apk

    View Slide

  11. Android App Bundle

    View 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 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

    View 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
    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 Slide

  15. 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 Slide

  16. 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 Slide

  17. Android App Bundle

    View Slide

  18. Android App Bundle
    FRESH!
    35.8%
    saving

    View Slide

  19. Dynamic Delivery

    View Slide

  20. Dynamic Delivery
    Sell
    Browse
    Buy
    e-commerce app

    View Slide

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

    View Slide

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

    View Slide

  23. Dynamic Delivery

    View Slide

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

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

    View Slide

  25. Develop

    Android App Bundle

    View Slide

  26. Environment

    View Slide

  27. Environment

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

    View Slide

  28. Build App Bundle

    View Slide

  29. Build App Bundle

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

    ./gradlew bundleDevRelease

    View Slide

  30. Build App Bundle

    module/build/outputs/bundleVariant/bundle.aab

    View Slide

  31. Publish bundle.aab

    View Slide

  32. Publish bundle.aab

    View Slide

  33. Prepare keystore

    $ java -jar pepk.jar \

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

    --output=[encrypted_private_key] \

    --encryptionkey=[hogehogehoge]

    View Slide


  34. $ java -jar pepk.jar \

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

    --output=[encrypted_private_key] \

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

    View Slide


  35. $ java -jar pepk.jar \

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

    --output=[encrypted_private_key] \

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

    View Slide


  36. $ java -jar pepk.jar \

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

    --output=[encrypted_private_key] \

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

    View Slide


  37. $ java -jar pepk.jar \

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

    --output=[encrypted_private_key] \

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

    View Slide


  38. $ java -jar pepk.jar \

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

    --output=[encrypted_private_key] \

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

    View Slide

  39. Publish bundle.aab

    View Slide

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

    View Slide

  41. bundle tool

    $ bundletool build-apks \

    --bundle= \
    --output=


    View Slide

  42. bundle tool
    $ mkdir apks

    $ unzip out.apks -d apks

    View Slide

  43. 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 Slide

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

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

    View Slide

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

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

    View Slide

  46. bundle tool
    $ bundletool extract-apks \

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

    View Slide

  47. bundle tool
    $ bundletool extract-apks \

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

    View Slide

  48. bundle tool
    $ bundletool extract-apks \

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

    View Slide

  49. bundle tool
    $ bundletool extract-apks \

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

    View Slide

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

    base-arm64_v8.apk
    base-en.apk

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  61. Appendixes

    View Slide

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

    @DroidKaigi2018
    https://goo.gl/b7kHhf

    View Slide

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

    View Slide

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

    View Slide

  65. Summary

    View Slide

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

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

    View Slide

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


    2日目のSandboxで2時間

    3日目のOffice Hourで2時間

    View Slide

  68. @_a_akira
    AAkira
    Thanks

    View Slide