來使用AppBundle吧!

appBundle

What is App Bundle

Google Play’s new app serving model, called Dynamic Delivery, to generate and serve optimized APKs for each user.

More details
.aab is compressing file like .zip, and it contains ProtoBuffer formate files.

Generation of result types

  • Base APK
    the main part of your application.
  • Configuration APKs
    the native libraries(.so) and resources for a specific screen density, CPU architecture, or language.
  • Dynamic feature APKs
    the dynamic modules, which can download and install by calling APIs in the Play Core Library from the Google Play Store.
More details

How to build

FILEPATH:
app-----------------------------
build
outputs
\develop(Build Variant)
app.aab
signed .aab
FILEPATH:
app----------------------------
production
release
app.aab

How to test

Test how Google Play uses .aab to generate APKs and how those APKs behave when deployed to a device.
  1. locally using the bundletool command line tool.
  2. uploading your bundle to the Play Console and using a test track.

Test 1 : BundleTool

setup

  1. download bundleTool file .jar or source code(it will need build by yourself)
  2. set up the environment variable, $ANDROID_HOME, to your Android/sdk path
edit file .bash_profile like this
localhost$ vim ~/.bash_profile
localhost$ source ~/.bash_profile
localhost$echo $ANDROID_HOME

generate apks

  1. generate APK set for all device configurations you wnat support.
    unsigned APKs :
    $ java -jar /Users/deer/Documents/tool/bundletool.jar build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks
    signed APKs :
    $ java -jar /Users/deer/Documents/tool/bundletool.jar build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks
    --ks=/MyApp/keystore.jks --ks-pass=file:/MyApp/keystore.pwd
    --ks-key-alias=MyKeyAlias --key-pass=file:/MyApp/key.pwd

install apks

  1. connect your device by USB
  1. use the command in android studio Terminal, like this:
    $ java -jar /path1/tool/bundletool.jar install-apks --apks=/path2/project/app/build/outputs/bite.apks
    * path1 is your bundletool.jar path, path 2 is the apks
    more:
    you can set the java -jar /path2/tool/bundletool.jar to
    alias command bundletool.

reference

Download: https://github.com/google/bundletool/releases
Android App Bundle Part-2 : BundleTool
Android App Bundle 构建流程浅析

Test 2 : in PlayStore

設定 :由 Google 管理及保護您的應用程式簽署金鑰
將產生完的 .aab檔 上傳至測試版,用測試帳號測試。
可以選用下面其中一種方式:
  1. 上傳至 內部測試版 或 Alpha版,內部測試人員從 Google play 下載。
  2. 上傳至 內部應用程式分享,再透過分享連結下載。
  3. 探索 App Bundle 功能。

留言

熱門文章