來使用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.
13
1
android {
2
bundle {
3
abi {
4
enableSplit = true
5
}
6
density {
7
enableSplit = true
8
}
9
language {
10
enableSplit = true
11
}
12
}
13
}
How to build
FILEPATH:app-----------------------------
buildsigned .aab
outputs
\develop(Build Variant)
app.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.- locally using the bundletool command line tool.
- uploading your bundle to the Play Console and using a test track.
Test 1 : BundleTool
setup
- download bundleTool file .jar or source code(it will need build by yourself)
- 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
- 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
- connect your device by USB
- 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/releasesAndroid App Bundle Part-2 : BundleTool
Android App Bundle 构建流程浅析
Test 2 : in PlayStore
設定 :由 Google 管理及保護您的應用程式簽署金鑰將產生完的 .aab檔 上傳至測試版,用測試帳號測試。
可以選用下面其中一種方式:
- 上傳至 內部測試版 或 Alpha版,內部測試人員從 Google play 下載。
- 上傳至 內部應用程式分享,再透過分享連結下載。
- 探索 App Bundle 功能。
留言
張貼留言