How to deploy an aab file on device?

a_subscriber picture a_subscriber · Aug 23, 2019 · Viewed 7.2k times · Source

in my android app if I want to update APK file I use this:

adb install -r some_my.apk

Nice. It's work. Now I sign my bundle and as result Android Studio 3.5. generate : AAB (Android App Bundle) file. Nice.

Now I install prev app from Google Play. And I want to update my app by AAB.

How I can do this?

If I try this:

adb install -r some_my.aab

I get error:

adb.exe: need APK file on command line

Answer

Gabriele Mariotti picture Gabriele Mariotti · Aug 23, 2019

Android App Bundles is a publishing format and you can't install the aab file on a device.

You can check the official doc.

An app bundle is different from an APK in that you can’t deploy one to a device. Rather, it’s a upload format that includes all your app’s compiled code and resources in a single build artifact.

You can extract the apks files from the aab file using the bundletool command.

To generate an APK set for all device configurations (signed with a debug key) you can use:

bundletool build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks

To deploy your app from an APK set, use the install-apks

bundletool install-apks --apks=/MyApp/my_app.apks