Ionic Cordova Build Android AAB Bundle
Recently I tried to upload a new APK into the Google Play Store just to find out that you are no longer allowed to upload APK files. You now need to upload AAB bundle files.
Here is how you can do it for Ionic. Run the following command at the root of your Ionic project.
$ ionic cordova platform add android $ ionic cordova build android --prod --release -- -- --packageType=bundle
This will build your Ionic app into an AAB bundle for Android. If you need to sign your APKs that are bundled, you can extend the command above e.g.
$ ionic cordova build android --prod --release -- -- --packageType=bundle --keystore=./keystore-file.keystore --storePassword=keystore-password --alias=keystore-alias --password=password
Yes. You saw that right. I am using double double hyphens ( — — ). To see what all the additional options mean, please read the official Cordova guide.
You can find your AAB bundle files after it compiled successfully here: ./platforms/android/app/build/outputs/bundle/release/app-release.aab
There is no need to zip-align the bundle. You can simply upload the compiled AAB bundle file when you prepare your next release for the Google Play Store.
Ionic Cordova Build iOS
The process for building iOS apps using Ionic Cordova is still the same. At the root of your Ionic project, run the following command.
$ ionic cordova platform add ios $ ionic cordova build ios --prod
The easiest way to upload your iOS app to the App Store is via Xcode. Ionic has an in-depth guide on how to build your app for iOS.