Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to do prod build in ionic capacitor

In ionic 4, how to do a release aka prod build?

The angular part can be build in prod mode by ionic build --prod

Now how to copy this build to android? If I do ionic capacitor run android it will do normal build first and then copy assets to android. But I want to build in prod mode and take assets to android.

(I know how to generate apk in Android studio)

like image 387
Harvinder singh Avatar asked Jul 10 '20 09:07

Harvinder singh


1 Answers

After doing ionic build --prod

Assuming you have already installed Capacitor, otherwise you can follow this and thereafter, You can do the following

npx cap copy android

Which copies the built code to android folder.

Then you can do

npx cap open android

Which opens android studio if you havent opened it already, then you should go to Build -> Generate Signed Bundle / APK option and the rest is quite straightforward.

enter image description here

More info can be found here

like image 152
Athif Shaffy Avatar answered Oct 30 '22 08:10

Athif Shaffy