bundletool

Manipulate Android App Bundles and APKs

TLDR

Build APK set from app bundle
$ bundletool build-apks --bundle=[app.aab] --output=[app.apks]
Build APKs with signing
$ bundletool build-apks --bundle=[app.aab] --output=[app.apks] --ks=[keystore.jks] --ks-key-alias=[alias]
Install APKs to connected device
$ bundletool install-apks --apks=[app.apks]
Extract APKs for specific device
$ bundletool extract-apks --apks=[app.apks] --output-dir=[output] --device-spec=[device.json]
Get device specification
$ bundletool get-device-spec --output=[device.json]
Validate app bundle
$ bundletool validate --bundle=[app.aab]
Print bundle info
$ bundletool dump manifest --bundle=[app.aab]
Build universal APK containing all configurations
$ bundletool build-apks --mode=universal --bundle=[app.aab] --output=[app.apks]
Build APKs for the connected device only
$ bundletool build-apks --connected-device --bundle=[app.aab] --output=[app.apks]
Get APK size estimates
$ bundletool get-size total --apks=[app.apks]

SYNOPSIS

bundletool command [options]

DESCRIPTION

bundletool is the command-line tool for manipulating Android App Bundles. It builds app bundles, generates APK sets for various device configurations, and installs APKs to connected devices.The tool is used by Android Studio, the Android Gradle plugin, and Google Play to build and process Android App Bundles.

PARAMETERS

--bundle file

Path to Android App Bundle (.aab)
--output file
Output file path
--apks file
Path to APK set archive
--device-spec file
Device specification JSON file
--ks file
Path to keystore for signing
--ks-pass pass
Keystore password (pass:password or file:/path)
--ks-key-alias alias
Key alias in keystore
--key-pass pass
Key password (pass:password or file:/path)
--connected-device
Target only the currently connected Android device's configuration.
--device-id serial
Specify a device by ADB serial number.
--mode mode
APK generation mode: default, universal, system, persistent, instant, archive.
--local-testing
Add metadata for local feature module (dynamic delivery) testing.
--overwrite
Overwrite existing output file.
--aapt2 path
Path to a custom AAPT2 binary.

COMMANDS

build-bundle

Build Android App Bundle from module zip files
build-apks
Generate APK set from app bundle
extract-apks
Extract APKs for specific device configuration
install-apks
Install APKs to connected device
get-device-spec
Write device specification to JSON file
validate
Verify app bundle validity
dump
Print bundle information in human-readable form
get-size
Compute download size estimates
version
Print bundletool version

INSTALL

brew install bundletool
nix profile install nixpkgs#bundletool

CAVEATS

Requires Java Runtime Environment. Device installation requires ADB and a connected Android device. Signed APKs require keystore credentials. App bundles must be valid according to Android App Bundle specification.

SEE ALSO

adb(1), apksigner(1), zipalign(1)