Deploy applications on android using capacitor in Ionic

 In this post we going to created release APK using capacitor ionic. We going to explain from scratch how we are going to deploy signed bundle build. 

In our earlier tutorial we have already explain how we can create our first app using ionic.

Requirements

  • Node JS
  • VS Code
  • Android Studio
  • Developer Account on Google Play

Google Play Account

Before starting the tutorial, If you are planning to deploy your application on play store then make sure you have google developer account if not then you need to register for developer account and for that you need to pay $25 USD one time registration fee.

Installation of Android Studio

And also we need android studio to build our first application. If you do not have android studio then again you need to install android studio by using this link. It completely free.
 


Adding Capacitor in Project

We have already completed initial setups i.e. how we can create our first app using ionic. If you don't have already application on your computer, I would like you to request please go through in previous tutorial.

If you do not already install ionic then you need to install capacitor in your project. For install capacitor in your project you need to run following command.

npm install --save @capacitor/core @capacitor/cli
for initialize capacitor in our project need to run this command
npx cap init

Adding Android platform in project

To adding android platform you just need to run the following command in terminal window

npx cap add android

If you make any changes in your project after adding the platform then you need to following command to copy the change in android folder.

npx cap copy

After all these things now run this command,

npx cap open android

this will open you project in android studio. To open first time android studio make sure you have proper internet because it's need to install the gradle dependencies in your project.

Run Your project on Emulator

After successfully install of gradle dependencies, now time for run your application in android studio. Before running this make you have emulator and real device which is connected with your computer.

For running this you just need to click on run button and wait for successfully installation. Once the app is install its automatically open on your mobile/emulator screen.


Creating a build for Android

For deploying on play store you need to create a signed APK build. For generate signed bundle/APK you need to follow the below mention steps.

  1. In the menu bar, click Build > Generate Signed Bundle/APK.
  2. In the Generate Signed Bundle or APK dialog, select Android App Bundle or APK and click Next.




Now you need to pass the path of key store, if you don't have key store file you should create new on clicking create new

You need to fill all the information which is required in shown image after that click OK. 

Note:- Make sure you storing safe your key store file, because in update to your application of play store you need this file everything if  you missing this you cannot release new version on your application, And also make sure you using strong password and make sure do not lose it.

Now time for generate your build, there is two type of build in android one is debug and release. You need select release and then click on finish.


After successfully complete this step you will able to find you final APK build in following location.

projectfolder/android/app/release/app-release.apk
OR
projectfolder/android/app/release/app-release.abb

I hope you like this post if this will help you please share.😃

Post a Comment

1 Comments