22

Hi i am Working with android applications , When i try to upload developer console says the message , "enter image description here"

I hope we can reduce the app size through it , I tried in different ways i cannot get idea for that. Please help me out. Is there any Posibilities to do that.

3
  • please try to generate sign apk using android studio
    – Utpaul
    Apr 7, 2019 at 6:42
  • I Don't have any idea to build ionic app in to Android Studio. Can you please refer something. Apr 8, 2019 at 7:16
  • if you have android studio then just open android folder from your ionic app
    – Utpaul
    Apr 8, 2019 at 8:26

6 Answers 6

45

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
5
  • thank you bro. its work. Please version: cordova android >= 8.1.0 May 10, 2020 at 11:58
  • except when you sign, you cannot sign using apksigner. you need to use jarsigner. e.g. jarsigner -keystore my-release-key.keystore app-release-signed.aab app-release-key
    – Hawk
    May 25, 2020 at 4:14
  • After I generated this .aab , and trying to upload the play store got "To upload an Android App Bundle you must be enrolled in Play App Signing." this error. Any idea on this Mar 19, 2021 at 9:53
  • I'm also getting the issue on upload .aab file, To upload an Android App Bundle you must be enrolled in Play App Signing. Is there any more step need to do after created .aab file? Please help any one on this we are urgent on upload in play store. Sep 6, 2021 at 15:17
  • For sign AAB file this will be 2nd command : jarsigner -sigalg SHA256withRSA -digestalg SHA-256 -keystore releaseApp.jks ./platforms/android/app/build/outputs/bundle/release/app-release.aab release Dec 9, 2021 at 16:40
25

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 usual

  • change into the /platforms/android folder and run ./gradlew bundleRelease. On Windows, the file might be called gradlew.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.

2
  • thanks for the answer let me try , I will get back to you soon Oct 4, 2019 at 4:21
  • 1
    quick note for future Googlers, if you got here from a search for why you're no longer getting apk files from your build: first cordova-android@8.1.0 enabled building both apk and aab files by default, and then cordova-android@10.0.0 changed to building only aab files by default. github.com/apache/cordova-android/blob/master/RELEASENOTES.md Sep 1, 2022 at 13:34
2

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
1
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`
0

Adding to Matti's answer here: I needed to use another extra -- before "--packageType" to make it work. I was using powershell and ionic. The final working command was like this :

ionic cordova build android --prod --release -- -- -- --packageType=bundle

So if the command provided by Matti is generating a release .apk for you instead of an .aab, try this one instead

0

Default release bundle type is .aab (when use --packageType=bundle). Need apk then use below commend :-

 ionic cordova build android --release -- -- --packageType=apk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.