Cordova 8.1+ supports generating Android Bundle (.aab
file). Usually cordova generates an .apk
file for your app. Playstore often warns about .apk
file about it’s bloated size.
To generate an .aab
file, add --packageType=bundle
option to your cordova build
command.
cordova build android --release -- --packageType=bundle
Here is the command I use to generate a singed bundle.
cordova build android --release -- --keystore=~/keystore/dilawar.jks --storePassword=$(KEYSTORE_PASSWORD) --alias=dilawar --password=$(KEYSTORE_PASSWORD) --packageType=bundle --webpack.mode=production
See the discussion here. And feature request here https://github.com/apache/cordova-android/issues/729 .
These instructions were posted here https://github.com/apache/cordova-android/issues/610#issuecomment-499114935. They worked for me.
I did not find any significant reduction in the app size when using the .aab
format (signed bundle). My app was reduced from 6.8MB to 6.5MB :neutral_face: