Reputation: 861
I'm an ionic developer and I've been dealing with these new requirements of Google Play when submitting an update (or a new app):
Starting in August 2021, new apps will need to Publish with the Android App Bundle format.
Starting in November 2021, app updates will be required to target API level 30 or above and adjust for behavioral changes in Android 11. Existing apps that are not receiving updates are unaffected and can continue to be downloaded from the Play Store. Wear OS apps must continue to target API level 28 or higher.
I'm using ionic/cli v6.16.3 and cordova v10.0.0 and I can't create the aab bundle with the following command:
ionic cordova build android --prod --release -- -- --packageType=bundle
It used to work fine with my previos cordova version (v9) but it has stopped working since I upgrade to cordova v10.
Apart from that, I wasn't sure if I had to sign the bundle with APKSIGNER scheme v2.
Upvotes: 5
Views: 5609
Reputation: 19941
I am using Cordova v10.0.0, and this command is working for me:
cordova build android --release -- --buildConfig --packageType=bundle
The order of the params may be important. No need to use a gradlew
command. The .aab
file is created and stored in the platforms\android\app\build\outputs\bundle\release\
folder.
Note that it didn't work until I updated the cordova-android dependency: cordova platform rm android
followed by cordova platform add android
(based on this other answer); the version is now 9.1.0.
Upvotes: 1
Reputation: 1159
You will probably be forced to use apksigner instead of jarsigner when you go to release your app on the play store. Also with apksigner the order of signing and zipping changed.
Cordova Example:
build
cordova build --release android
zip
cd platforms/android/app/build/outputs/apk/release
~/Library/Android/sdk/build-tools/31.0.0/zipalign -v 4 app-release-unsigned.apk YOUR_APP_NAME_HERE.apk
sign
~/Library/Android/sdk/build-tools/31.0.0/apksigner sign -ks ../../../../../../../THE_NAME_OF_YOUR_KEYS.keystore YOUR_APP_NAME_HERE.apk
Upvotes: 0
Reputation: 861
Finally, I got to this conclusion and this is what it worked for me:
APKSIGNER scheme v2 must to be used only in APK formats targeting API level 30.
On the contrary, if we use an App Bundle format, there is no need to sign the bundle using APSIGNER v2 scheme.
So, the steps I followed to successfully upload an abb bundle targeting API level 30 into Google Play are:
1. Generate the bunde
ionic cordova build android --prod --release - - --packageType=bundle
If the aab is not generated with this command then we have to generate it manually as follows:
Go to folder .\platforms\android\ and execute:
.\gradlew.bat bundleRelease
Remove .bat if you are in lunuex or mac.
This will generate an aab file in \platforms\android\app\build\outputs\bundle\release
2. Locally sign the aab (this is necessary to support older Android versions)
We have to copy the generated aab located in \platforms\android\app\build\outputs\bundle\release, which is unsigned, to the path were the keystore and the jarsiner tool are located (in my case is the JDK path: C:\Program Files\Java\jdk1.8.0_201\bin).
Then, open the console (with Admin permissions), go to that directory and execute:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore name-of-keystore.jks app_name.aab keystore-alias
(*Rename arguments: name-of-keystore.jks, app_name.aab and keystore-alias)
3. Align the abb
Before uploading the aab you can align it by running:
zipalign.exe -v 4 signed app_name.aab aligned_app_name.aab
(*Rename arguments: app_name.aab and aligned_app_name.aab)
This aligned aab is the one that must be uploaded into Google Play
Upvotes: 4