Building Android App with Capacitor 3

It appears that a few things have changed when building a production app with Capacitor 3. Previously you were able to use the CLI to sign and build your release version of the APK, but now it appears that you need to use the Android Studio IDE to do so.

I am unable to figure out how to build my app within Android Studio.

It does not appear that I have any options available under my Build menu once the IDE launches after running the build command.

Does anyone have any suggestions on where to begin when trying to use Android Studio for the first time for a production build?

Capacitor has never allowed to build signed APKs from the CLI.

If the Build → Generate Signed Bundle / APK is greyed out, there is probably something wrong with your project, try clicking the “Sync Project with Gradle Files” (elephant icon)

Sorry, my original post wasn’t more clear.

I had recently updated my project from Cordova to Capacitor 3, so I was unaware that with Capacitor you were required to use the IDE to compile now for Android.

This is what I was previously seeing when loading the app in Android Studio:

Screen Shot 2021-08-28 at 8.48.31 AM

I updated my Android Studio to 2020.3.1 (Arctic Fox) and I know have the ability to build the app.

who said capacitor app can’t be build using CLI… Just check out

For debug, debug-production build use the below methods
ionic capacitor copy android
ionic capacitor copy android --prod
from your root project.
and then run
./gradlew assembleDebug
from ‘android’ folder located in root of your project

For release build use the below methods

ionic capacitor copy android --prod --release
from your root project.
and then run
./gradlew assembleRelease
from ‘android’ folder located in root of your project, sign the release build using the same method as you used for CLI

1 Like

In case I was not clear, it’s not possible from Capacitor CLI. Of course you can use gradle, fastlane or other CLI tooling to build apps, but not Capacitor CLI.

Yes sorry for misunderstanding … I am using ionic cli…Not capacitor cli…But building is possible through any one cli as per the thread question

This is just what I was looking for.

Does the assembleRelease command compile the app into the newly required .aab file for the Google Play Store?

If so, are the jarsigner and zipalign commands still used to sign the .aab file?


This page may now be out of date since the Play Store is no longer accepting APKs.

Ofcourse you can
.gradlew assembleRelease for apk build and
.gradlew bundleRelease for aab build
And get your app from appropriate path for signing