Android App Bundles
简而言之,可以理解Google 官方的动态发布方案
WHAT
好处
- Size更小
Google has claimed that it can reduce app sizes up to 50 percent
Its own apps like YouTube and other apps like LinkedIn which saw a 23% file reduction - 安装更快
- 支持动态发布
限制
- 仅限于通过 Google Play 发布的应用,(Google进一步巩固自身生态)
- 需要加入到 Google 的 beta program
- enroll your app in app signing by Google Play in the Play Console
- 最低支持版本Android 5.0 (API level 21)
- 低于Android 5.0 (API level 21) 的版本GooglePlay会优化Size,但不支持动态交付。
成本
- 需要升级到Android Studio 3.2修改工程以便支持App Bundle格式
- 集成Play Core Library
原理
Android App Bundle 是一种全新发布格式,能大幅度减少应用体积。
只须在 Android Studio 中构建一个应用束 (app bundle),就可以将应用所需的全部内容 (适用于所有设备) 都涵盖在内:所有语言、所有设备屏幕大小、所有硬件架构。接着,在用户下载您的应用时,Google Play 的新动态交付只会传输适用于用户设备的代码和资源。人们在 Play Store 上看到的安装包体积更小,下载速度也越快,同时也节省了设备存储空间。
△ (左) 旧版 APK 交付样例 - 将全部资源都交付至设备;
(右) 动态交付样例 - 只向设备交付必要资源
结合Google Play Dynamic Delivery (动态交付) , 实现动态功能
Android App Bundle 支持模块化,通过Dynamic Delivery with split APKs,将一个apk拆分成多个apk,按需加载(包括加载C/C++ libraries),这样开发者可以随时按需交付功能,而不是仅限在安装过程中。
- Base Apk
首次安装的apk,公共代码和资源,所以其他的模块都基于Base Apk - Configuration APKs
native libraries 和适配当前手机屏幕分辨率的资源 - Dynamic feature APKs
不需要在首次安装就加载的模块
How
官方手把手改造教程 https://developer.android.com/guide/app-bundle/configure
创建动态交付模块 https://developer.android.com/guide/app-bundle/configure#create_dynamic_feature
More
About Android App Bundles : https://developer.android.com/guide/app-bundle/