Distributing APK from .aab bundle
Problem with Android app bundle is that, It can’t be installed directly to android devices.
So If you want to test out your application before you role it out, you have to generate APK out of it.
Here are few command which might come handy in the process.
Installation of Bundletool:
- If you have brew installed simply run
brew install bundletool
and the alias will be set up for you as well. - If not you can go ahed and download jar file from release on github. Here’s link to release. (Note: After downloading jar file run
alias bundletool='java -jar <Path/to/file>.jar
)
Usage of bundletool:
- If you want to generate universal apk you can use command:
bundletool build-apks --bundle=<Path/to/file>.aab --output=output.apks --mode=universal
It will generate file with name output.apks. Go ahed and rename it as outputs.zip and unzip it.
It will contain universal.apk. That’s the APK which you can use.
2. If you want to install app from apks to your connected device you can use:
bundletool install-apks --apks=output.apks
3. If you want to generate all the APKs out of the bundle you can run:
bundletool build-apks --bundle=<Path/to/file>.aab --output=output.apks
It will generate file with name output.apks. Go ahed and rename it as outputs.zip and unzip it. It will contain different different APK for all types of device.
For more usage of bundletool command refer this.