Newlyweds Proposing Marriage
    Wondering what’s next for npm?Check out our public roadmap! »


    1.13.2 • Public • Published

    Bubblewrap CLI

    Node CI Status

    Bubblewrap is a Command Line Interface (CLI) that helps developers to create a Project for an Android application that launches an existing Progressive Web App (PWA) using a Trusted Web Activity (TWA).


    Setting up the Environment

    When running Bubblewrap for the first time, it will offer to automatically download and install external dependencies. This is the recommended setup, but it's possible to manually setup the environment.

    Quickstart Guide

    Installing Bubblewrap

    npm i -g @bubblewrap/cli

    ⚠️ Warning: Don't use sudo npm i -g @bubblewrap/cli to install Bubblewrap. Using npm commands with sudo can create different kinds of problems and should be avoided (see here and here).

    Initializing an Android Project

    Generate an Android project from an existing Web Manifest:

    bubblewrap init --manifest

    When initalizing a project, Bubblewrap will download the Web Manifest and ask you to confirm the values that should be used when building the Android project.

    It will also ask you for the details needed to generate a signing key, used to sign the app before uploading to the Play Store.

    Even though we recommend Bubblewrap for building and generating a signed APK, the output from the init command is a regular Android project that can be opened and built using Android Studio. Please, refer to the documentation to build and sign applications using Android Studio.

    Building the Android Project

    bubblewrap build

    When building the project for the first time, the Android Build Tools will need to be installed. The tool will inkove the installation process for the build tools. Make sure to read and accept the license agreement before proceeding. This process will install the other required files inside the directory/decompressed root directory of the android CLI package.

    As a result of the build step, the tool will generate a signed APK (app-release-signed.apk) that can be used for testing the app and a signed AppBundle (./app-release-bundle.aab) that can be uploaded to the Play Store. You will also need to deploy a Digital Asset Links file to validate your domain. The TWA Quick Start Guide explains how to extract the information needed to generate it.


    Overview of bubblewrap commands

    The diagram above shows which commands (in the black boxes) take as input or produce as output various files (in white ovals). An arrow leading to a file means "creates or modifies" and an arrow leading to a command means "is used as input".



    Initializes an Android project for Trusted Web Activity from a Web Manifest. The init script will parse the Web manifest and generate default values for the Android project, where possible. It will prompt the user to confirm or input values where one could not be generated.

    bubblewrap init --manifest="<web-manifest-url>" [--directory="<path-to-output-location>"] [--chromeosonly]


    • --directory: path where to generate the project. Defaults to the current directory.
    • --chromeosonly: this flag specifies that the build will be used for Chrome OS only and prevents non-Chrome OS devices from installing the app.
    • --alphaDependencies: enables features that depend on upcoming version of the Android library for Trusted Web Activity or that are still unstable.


    Builds the project into a final APK that can be uploaded to the Play Store.

    The command will ask the user for they key store passwords. Alternatively, users can set the passwords as enviromental variables, which allows running build as part of a continuous integration. Set BUBBLEWRAP_KEYSTORE_PASSWORD for the key store password and BUBBLEWRAP_KEY_PASSWORD as the key password.


    bubblewrap build [--skipPwaValidation] [--skipSigning] [--manifest="<path-twa-manifest>"] [--signingKeyPath="<path-to-signing-key>"] [--signingKeyAlias="<key-alias>"]


    • --skipPwaValidation: skips validating the wrapped PWA against the Quality Criteria.
    • --skipSigning: skips signing the built APK and App Bundle. Other signing-related flags are ignored when this is used.
    • --signingKeyPath: path to keystore to use for signing the built APK and App Bundle. Overrides signingKey.path specified in twa-manifest.json.
    • --signingKeyAlias: key name. Overrides signingKey.alias specified in twa-manifest.json.
    • --manifest: directory where the client should look for twa-manifest.json.


    Regenerates the Android project files from a twa-manifest.json file.

    ⚠️ Warning: Bubblewrap doesn't expect the generated Android project to be updated using external editors. Any files added manually to the Android project will be deleted or overwritten when update is executed. Changes to twa-manifest.json are preserved.


    bubblewrap update [--appVersionName="<version-string>"] [--skipVersionUpgrade] [--manifest="<path-twa-manifest>"]


    • --appVersionName: version name to be used on on the upgrade. Ignored if --skipVersionUpgrade is used.
    • --skipVersionUpgrade: skips upgrading appVersion and appVersionCode.
    • --manifest: directory where the client should look for twa-manifest.json.


    Validates a PWA agains the Quality Criteria for being using in a Trusted Web Activity.


    bubblewrap validate --url=[pwa-url]


    Install the application generated in the output command to a device connected for debugging.


    bubblewrap install [--apkFile="/path-to-apk/apkfile.apk"]


    • --apkFile: path to the APK file to be installed. Defaults to ./app-release-signed.apk.
    • --verbose: prints the adb command being executed.


    Displays a list of commands and options.


    bubblewrap help


    Validates that the jdk and the androidSdk are located at the path specified in your config and that they are at the correct version.


    bubblewrap doctor


    Sets the paths of the jdk or the androidSdk to the given paths.


    bubblewrap updateConfig  --jdkPath="/path-to-jdk" --androidSdkPath="/path-to-androidSdk"


    • --jdkPath: sets the jdk's path to the path given.
    • --androidSdkPath: sets the androidSdk's path to the path given.


    Merges the user's web manifest into their twaManifest.json.


    bubblewrap merge --ignore [fields-list]


    • --appVersionName: version name to be used on on the upgrade. Ignored if --skipVersionUpgrade is used.
    • --skipVersionUpgrade: skips upgrading appVersion and appVersionCode.
    • --ignore: Ignores all of the fields on the list. Accepts all of the possible fields in the Web Manifest.


    Manages the list of fingerprints used to generate the Digital Asset Links file for the web application.


    bubblewrap fingerprint [subcommand]

    Global flags:

    • --manifest=<manifest>: path to the Trusted Web Activity configuration.',



    Adds a fingerprint to the project configuration.


    bubblewrap fingerprint add [SHA-256 fingerprint] <flags>

    Additional flags:

    • --name=<name>: optionally set a name to help identify the fingerprint. The name is printed along with the fingerprint when using the list subcommand.


    Removes a fingerprint from the project configuration.


    bubblewrap fingerprint remove [SHA-256 fingerprint] <flags>


    Lists the fingerprints in the project configuration.


    bubblewrap fingerprint list <flags>


    Generates an AssetLinks file from the project configuration


    bubblewrap fingerprint generateAssetLinks <flags>


    • --output=<filename>: path from where to load the project configuration.

    Manually setting up the Environment

    Get the Java Development Kit (JDK) 8.

    The Android Command line tools requires the correct version of the JDK to run. To prevent version conflicts with a JDK version that is already installed, Bubblewrap uses a JDK that can unzipped in a separate folder.

    Download a version of JDK 8 that is compatible with your OS from AdoptOpenJDK and extract it in its own folder.

    ⚠️ Warning: Using a version lower than 8 will make it impossible to compile the project and higher versions are incompatible with the Android command line tools.

    Get the Android command line tools

    Download a version of Android command line tools that is compatible with your OS from Create a folder and extract the downloaded file into it. This will further install the androidSdk and android SDK manager without needing to install the whole Android IDE.

    Tell Bubblewrap where the JDK and Android command line tools are

    When running bubblewrap for the first time, it will ask where it can find the JDK and Android command line tools. So, take note of the location where both were decompressed.

    To ensure if you are taking note of the correct location, check if each directory contains the following files:

    • On Windows and Linux, the correct OpenJDK path should contain bin, include ,lib, etc. On MacOS, the directory should contain the Contents subdirectory.
    • The AndroidSDK path should contain tools which should have bin, cli

    Updating the location of the JDK and / or the Android command line tools.

    If the location for the JDK or the Android command line tools have been setup with the wrong path or if their location has changed after the initial configuration, the location for either of those can be changed by editing the configuration file at ${USER_HOME}/.bubblewrap/config.json.

    Sample config.json


    (Note : Make sure you don't have spaces in the androidSdkPath. Check this link for more details.)


    See CONTRIBUTING for more.


    See LICENSE for more.


    This is not a Google product.




    npm i @bubblewrap/cli

    DownloadsWeekly Downloads






    Unpacked Size

    147 kB

    Total Files


    Last publish


    • avatar