Install Android App Bundle on device

AndroidAndroid App-Bundle

Android Problem Overview


I built my project using the new Android App Bundle format. With APK files, I can download the APK to my device, open it, and immediately install the app. I downloaded my app as a bundle (.aab format) and my Nexus 5X running Android 8.1 can't open the file. Is there any way to install AABs on devices in the same convenient manner as APKs?

Android Solutions


Solution 1 - Android

Short answer:

Not directly.

Longer answer:

Android App Bundles is the default publishing format for apps on the Google Play Store. But Android devices require .apk files to install applications.

The Play Store or any other source that you're installing from will extract apks from the bundle, sign each one and then install them specific to the target device.

The conversion from .aab to .apk is done via bundletool.

You can use Internal App Sharing to upload a debuggable build of your app to the Play Store and share it with testers.

Solution 2 - Android

Installing the aab directly from the device, I couldn't find a way for that.

But there is a way to install it through your command line using the following documentation You can install apk to a device through BundleTool

According to "@Albert Vila Calvo" comment he noted that to install bundletools using HomeBrew use brew install bundletool

You can now install extract apks from aab file and install it to a device

Extracting apk files from through the next command

> java -jar bundletool-all-0.3.3.jar build-apks --bundle=bundle.aab --output=app.apks --ks=my-release-key.keystore --ks-key-alias=alias --ks-pass=pass:password

Arguments:

  • --bundle -> Android Bundle .aab file
  • --output -> Destination and file name for the generated apk file
  • --ks -> Keystore file used to generate the Android Bundle
  • --ks-key-alias -> Alias for keystore file
  • --ks-pass -> Password for Alias file (Please note the 'pass' prefix before password value)

Then you will have a file with extension .apks So now you need to install it to a device

> java -jar bundletool-all-0.6.0.jar install-apks --adb=/android-sdk/platform-tools/adb --apks=app.apks

Arguments:

  • --adb -> Path to adb file

  • --apks -> Apks file need to be installed

Solution 3 - Android

For MAC:

brew install bundletool
bundletool build-apks --bundle=./app.aab --output=./app.apks
bundletool install-apks --apks=app.apks

Solution 4 - Android

You cannot install app bundle [NAME].aab directly to android device because it is publishing format, but there is way to extract the required apk from bundle and install it to you device, the process is as follow

  1. Download bundletool from here
  2. run this in your terminal,
java -jar bundletool.jar build-apks --bundle=bundleapp.aab --output=out_bundle_archive_set.apks
  1. Last step will generate a file named as out_bundle_archive_set.apks, just rename it to out_bundle_archive_set.zip and extract the zip file, jump into the folder out_bundle_archive_set > standalones, where you will seee a list of all the apks

There goes the reference from android developers for bundle tools link

android developer reference

Solution 5 - Android

If you want to install apk from your aab to your device for testing purpose then you need to edit the configuration before running it on the connected device.

  1. Go to Edit Configurations
    enter image description here
  2. Select the Deploy dropdown and change it from "Default apk" to "APK from app bundle".enter image description here
  3. Apply the changes and then run it on the device connected. Build time will increase after making this change.

This will install an apk directly on the device connected from the aab.

Solution 6 - Android

For those, who want single universal.apk that can run on every android device:

brew install bundletool
bundletool build-apks --mode universal --bundle ./app-release.aab --output ./app.apks
mv app.apks app.zip
unzip app.zip

Now, you can get your universal.apk

Solution 7 - Android

This worked for me on a mac. You need to use a tool called bundletool You can install it incase if not already installed using brew

brew install bundletool

Run this command to extract and store the apks file at the desired location

bundletool build-apks --bundle=path/to/app-release.aab --output=/path/to/output/app.apks --local-testing

Install on a connected Android device

bundletool install-apks --apks=/path/to/output/app.apks

I have noted the complete command with output in a gist here https://gist.github.com/maheshmnj/6f5debbfae2b8183d94ca789d081f026

Solution 8 - Android

Is there any way to install AABs on devices in the same convenient manner as APKs?

As installing is done by third party apps or mobile company file manager like apps.
The upcoming file managers versions, hence forth, will come with "aab" managing tools.

I searched "android aab installer" on playstore and found one.

enter image description here

deliberately not naming it.
The one I installed, extracted the bundle online,
But after that this app wasn't able to install this extracted app by itself (on my mi [miui] device ).
But this application saved the online extracted apk on phone memory, from where I was able to install it.
remember:
Google's "files" application wasn't able to install this apk
but
my system (in built) filer manager was able to.

Solution 9 - Android

Use (on Linux): cd android ./gradlew assemblyRelease|assemblyDebug

An unsigned APK is generated for each case (for debug or testing)

NOTE: On Windows, replace gradle executable for gradlew.bat

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionprfarlowView Question on Stackoverflow
Solution 1 - AndroidkeyboardsurferView Answer on Stackoverflow
Solution 2 - AndroidOmar HossamEldinView Answer on Stackoverflow
Solution 3 - AndroidErti-Chris EelmaaView Answer on Stackoverflow
Solution 4 - AndroidAli TamoorView Answer on Stackoverflow
Solution 5 - AndroidKartikeya_MView Answer on Stackoverflow
Solution 6 - AndroidwhalemareView Answer on Stackoverflow
Solution 7 - AndroidMahesh JamdadeView Answer on Stackoverflow
Solution 8 - Androidsifr_dot_inView Answer on Stackoverflow
Solution 9 - AndroidEddie RuizView Answer on Stackoverflow