Struct android_tools::bundletool::BuildApks [−][src]
pub struct BuildApks { /* fields omitted */ }
Expand description
Generate a set of APKs from your app bundle
When bundletool
generates APKs from your app bundle,it includes them in a container
called an APK set archive, which uses the .apks
file extension. To generate an APK
set for all device configurations your app supports from your app bundle, use the
bundletool build-apks
command, as shown below.
bundletool build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks
If you want to deploy the APKs to a device, you need to also include your app’s
signing information, as shown in the command below. If you do not specify signing
information, bundletool
attempts to sign your APKs with a debug key for you.
bundletool 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
The table below describes the various flags and options you can set when using the
bundletool build-apks
command in greater detail. Only --bundle
and --output
are
required—all other flags are optional.
Implementations
(Required
) Specifies the path to the app bundle you built using Android Studio.
To learn more, read Build your project
.
(Required) Specifies the name of the output .apks
file, which contains all the
APK artifacts for your app. To test the artifacts in this file on a device, go to
the section about how to deploy APKs to a connected device
.
Include this flag if you want to overwrite any existing output file with the same
path you specify using the --output
option. If you don’t include this flag and
the output file already exists, you get a build error.
Specifies a custom path to AAPT2. By default, bundletool
includes its own
version of AAPT2.
Specifies the path to the deployment keystore used to sign the APKs. This flag is
optional. If you don’t include it, bundletool
attempts to sign your APKs with a
debug signing key.
Specifies your keystore’s password. If you’re specifying a password in plain text,
qualify it with pass:. If you’re passing the path to a file that contains the
password, qualify it with file:. If you specify a keystore using the --ks
flag
without specifying --ks-pass
, bundletool
prompts you for a password from the
command line.
Specifies your keystore’s password. If you’re specifying a password in plain text,
qualify it with pass:. If you’re passing the path to a file that contains the
password, qualify it with file:. If you specify a keystore using the --ks
flag
without specifying --ks-pass
, bundletool
prompts you for a password from the
command line.
Specifies the alias of the signing key you want to use.
Specifies the password for the signing key. If you’re specifying a password in plain text, qualify it with pass:. If you’re passing the path to a file that contains the password, qualify it with file:.
If this password is identical to the one for the keystore itself, you can omit this flag.
Specifies the password for the signing key. If you’re specifying a password in plain text, qualify it with pass:. If you’re passing the path to a file that contains the password, qualify it with file:.
If this password is identical to the one for the keystore itself, you can omit this flag.
Instructs bundletool
to build APKs that target the configuration of a connected
device. If you don’t include this flag, bundletool
generates APKs for all device
configurations your app supports.
If you have more than one connected device, use this flag to specify the serial ID of the device to which you want to deploy your app.
Use this flag to provide a path to a .json
file that specifies the device
configuration you want to target. To learn more, go to the section about how to
Create and use device specification JSON files
.
Set the mode to universal if you want bundletool
to build only a single APK that
includes all of your app’s code and resources such that the APK is compatible with
all device configurations your app supports.
Note
bundletool
includes only feature modules that specify <dist:fusing dist:include="true"/>
in their manifest in a universal APK. To learn more, read
about the feature module manifest
.
Keep in mind, these APKs are larger than those optimized for a particular device configuration. However, they’re easier to share with internal testers who, for example, want to test your app on multiple device configurations.
Use this flag to enable your app bundle for local testing. Local testing allows for quick, iterative testing cycles without the need to upload to Google Play servers.
For an example of how to test module installation using the --local-testing
flag, see Locally test module installs
.