facebook / buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
https://buck.build
Apache License 2.0
8.56k stars 1.16k forks source link

Android App Bundles - Add Play feature delivery support for dex and native features in Buck #2586

Closed uKetki closed 3 years ago

uKetki commented 3 years ago

Background App Bundle is a new publishing format introduced by the Google team in an effort to reduce the redundant binary elements delivered to all android devices when installing a given app. The approach is to split apk contents such as resources for various screen densities, locale, and native libraries built for different architectures. After splitting, only required sub-components will be delivered for a given device.

Further to this, the Play feature delivery model which is introduced by the Google team relies heavily on app bundles. This is essentially a way to generate and serve optimized APKs by delivering features that are not required at the first launch or not affecting the core flow in a lazy manner. This is also a way to modularize app features and deliver features that are applicable to the specific user group (based on country, preference, etc) in a selective manner.


Existing Buck Support Currently, Buck supports the limited functionality of the App Bundles format. The below table summarizes the existing vs proposed state: App Bundle Supported in Buck Proposed Solution
Static Feature delivery locale :heavy_check_mark:
architecture :heavy_check_mark:
screen-density :heavy_check_mark:
Dynamic Feature Delivery dex :x: :heavy_check_mark:
native libraries :x: :heavy_check_mark:
resources :x:
Dynamic Asset Delivery assets :x:

The effort is to upstream Uber’s solution of adding dex and native lib support critical for enabling dynamic feature delivery in any Android mobile app built over Buck. The high-level overview of the changes are as follows:

With the current Buck state, out of the 5 modules, the generated aab contains only the base module:

.
.
├── BundleConfig.pb
└── base

To easily navigate through the changes, refer to individual tags / releases and the related description, along with: