How to make use of Android App Bundle in Ionic Applications?
ionic cordova build android --prod --release --alias=cos-android --password=abcd --versionCode=00001 --versionName=00001 -- -- -- --packageType=bundle
cordova build android --prod --release --alias=cos-android --password=abcd --versionCode=00001 --versionName=00001 -- -- --packageType=bundle`enter code here`
Is supported natively in cordova-android >= 8.1.0
ionic cordova build android --prod --release -- -- --packageType=bundle
Note the extra -- --
dashes before --packageType
. First --
is required by cordova. Second one is required because there is another cli tool between (ionic).
If you use cordova without ionic:
cordova build android --prod --release -- --packageType=bundle
Edit: See Matti's answer below if you're on Cordova >= 8.1.0
You need to have "cordova-android": 8.0.0
or later.
run
ionic cordova build android --prod --release
as usualchange into the
/platforms/android
folder and run./gradlew bundleRelease
. On Windows, the file might be calledgradlew.bat
instead.
This outputs the bundle at /platforms/android/app/build/outputs/bundle/release/app.aab
. Sign this bundle just like you would sign the APK and upload it to the Play Store.
Quick Answer
Step : 1
ionic cordova build android --prod --release -- -- --packageType=bundle
Step : 2
jarsigner -sigalg SHA256withRSA -digestalg SHA-256 -keystore releaseApp.jks ./platforms/android/app/build/outputs/bundle/release/app-release.aab release