How to build a Ionic5/Capacitor app for release?

this is my first app with Capacitor and I have to build this app for Android.

With Cordova I build an app with these commands:

1) ionic cordova build --prod --release android
2) cd ....myapp\platforms\android\app\build\outputs\apk\release\
3) jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myapp.keystore app-release-unsigned.apk myapp
4) zipalign -v 4 app-release-unsigned.apk MyApp-010001.apk

Now I read that with Capacitor I have to run these commands:

    - ionic build 
    - npx cap add android
    - npx cap copy android
    - npx cap open android

The last command opens Android Studio. OK

And then?
How can I:

  • sign the app? (step 3)
  • generate the apk that I have to upload on GooglePlay? (step 4)

I haven’t find a tutorial on this and I think it is strange that the Ionic site says only:
“Once Android Studio launches, you can build your app through the standard Android Studio workflow.”

Any help will be appreciated

Thank you very much


Then you can do a release build in Android Studio like a regular Android project, so you can follow the Android docs.

How to sign it depends if you have an upload key or a signing key.

1 Like

thank you for your answer.
I’ve followed these instructions:
However I will read the documents of your links.
thank you