'Install Android App Bundle on device
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?
Solution 1:[1]
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:[2]
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:[3]
For MAC:
brew install bundletool
bundletool build-apks --bundle=./app.aab --output=./app.apks
bundletool install-apks --apks=app.apks
Solution 4:[4]
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
- Download bundletool from here
- run this in your terminal,
java -jar bundletool.jar build-apks --bundle=bundleapp.aab --output=out_bundle_archive_set.apks
- Last step will generate a file named as
out_bundle_archive_set.apks
, just rename it toout_bundle_archive_set.zip
and extract the zip file, jump into the folderout_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
Solution 5:[5]
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.
- Go to Edit Configurations
- Select the Deploy dropdown and change it from "Default apk" to "APK from app bundle".
- 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:[6]
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:[7]
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:[8]
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.
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Shashank Agrawal |
Solution 3 | Erti-Chris Eelmaa |
Solution 4 | ToolmakerSteve |
Solution 5 | Kartikeya_M |
Solution 6 | |
Solution 7 | |
Solution 8 |