Search code examples
androidapkandroid-app-bundle

I can't Install Apk from android app bundle using command prompt


I referred bundletool command after that I created APKs using the command prompt. But I can't install apk in the device.

My path of apk's file is- D:\testRelease\XYZ.aab

So I try this command to install:-

--> bundletool.jar install-apks --apks=D:/testRelease/XYZ.apks

but can't get any output. I also tried to get connected to device-spec but still can't get any output


Solution

  • As a precondition remember to create an environment variable "ANDROID_HOME" and set it to where the Android SDK is located on your Development machine.

    So for Windows it may be

    ANDROID_HOME = "C:/MyAndroid"

    Assuming you are testing on just one device first generate the bundle only for your connected device using the following.

    bundletool build-apks --connected-device  --bundle="\somepath\app-release.aab" --output="\somepath\release.apks" --ks="somepath\keystore" --ks-pass=pass:cleartextpasswd --ks-key-alias=keyalias --key-pass=pass:cleartextpasswd
    

    Note the use of the option

    --connected-device

    Now to install on a specific device use the following command:

    bundletool install-apks --apks="somefolder\release.apks" --device-id="yourdeviceidstring"

    Get the device id string from the Settings section of your device.