question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Add native support for Android App Bundles / Dynamic Delivery

See original GitHub issue

Description of the problem / feature request:

Add the ability to build and publish Android APKs using the new App Bundles / Dynamic Delivery android features. See:

https://developer.android.com/platform/technology/app-bundle https://developer.android.com/guide/app-bundle/dynamic-delivery

Feature requests: what underlying problem are you trying to solve with this feature?

Use Bazel with App Bundles / Dynamic Delivery

What operating system are you running Bazel on?

MacOs or Linux

What’s the output of bazel info release?

Any

Have you found anything relevant by searching the web?

https://developer.android.com/platform/technology/app-bundle https://developer.android.com/guide/app-bundle/dynamic-delivery

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:16
  • Comments:25 (17 by maintainers)

github_iconTop GitHub Comments

8reactions
ahumeskycommented, May 19, 2021

Hi all,

Our approach to solving this issue is for us to provide a rule called android_application that replaces android_binary and supports building Android App bundles. The android_application rule will support configuration splits, as well as feature splits for assets and native libraries. We anticipate publishing it with enough time for adoption before the Play Store deadline.

If you would like to switch to using android_application and Bazel to generate an Android App Bundle from an existing Bazel target that uses android_binary:

  1. Replace android_binary with android_application.
  2. Move srcs (if any) to a new android_library target, then add that library to the deps of the android_application (android_applcation does not accept source files directly).
  3. Set bundle_config_file to a .pb.json bundle configuration, as per https://developer.android.com/studio/build/building-cmdline#bundleconfig to configure the splits for the application.

We’ll publish additional documentation and examples when we publish the android_applcation rule.

7reactions
ahumeskycommented, Jun 4, 2021

Hi all, I’ve published the preview to the pre-alpha branch here: https://github.com/bazelbuild/rules_android/tree/pre-alpha

Note that to get the bundletool dependencies, you’ll need to add rules_jvm_external to your workspace file if it’s not there already, and there’s some workspace setup now in @rules_android//:defs.bzl:

http_archive(
    name = "rules_jvm_external",
    strip_prefix = "rules_jvm_external-fa73b1a8e4846cee88240d0019b8f80d39feb1c3",
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/fa73b1a8e4846cee88240d0019b8f80d39feb1c3.zip",
)

http_archive(
    name = "rules_android",
    urls = ["https://github.com/bazelbuild/rules_android/archive/5c8bdd44193894594fa01fd527c5cf3af17e7652.zip"],
    strip_prefix = "rules_android-5c8bdd44193894594fa01fd527c5cf3af17e7652",
)
load("@rules_android//:defs.bzl", "rules_android_workspace")
rules_android_workspace()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview of Play Feature Delivery | Android Developers
Play Feature Delivery uses advanced capabilities of app bundles, allowing certain features of your app to be delivered conditionally or downloaded on demand...
Read more >
Configure on demand delivery - Android Developers
This page helps you add a feature module to your app project and configure it for on demand delivery. Before you begin, make...
Read more >
On Demand Modules - Android Developers
This page helps you configure your app to support Dynamic Delivery and add a dynamic feature module to your app project. Before you...
Read more >
Configure instant delivery - Android Developers
Under Dynamic features to deploy in the General tab, check the box next to each feature module you want to include when deploying...
Read more >
Migrate your instant app to support Android App Bundles
You can then include additional features that users can download on demand as instant experiences using the Dynamic Feature plugin. This setup ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found