Wednesday, October 18, 2017

Ionic 3 Build Android App - Create apk file which can be installed in an android device

Steps to create an apk file using ionic 3

Step1: Add Platform

$ ionic cordova add platform android

Step 2: Go to platforms/android

$ cd platforms/android

Note: Add the location of the bin folder of the JDK installation in the PATH Environment Variable

Step 3: Generate Keystore file 

$ keytool -genkey -v -keystore some_name.keystore -alias some_name-keyalg RSA -keysize 2048 -validity 10000

You should enter a password during the generation of some_name.keystore. Remember this passoword and keep some_name.keystore in a safe place.

Step 4: Open build.gradle file in platforms/android and search for the section signingConfigs. Make changes as shown below.

signingConfigs {
    release {
        // These must be set or Gradle will complain (even if they are overridden).
        keyAlias = "some_name"
        keyPassword = "your_password" // And these must be set to non-empty in order to have the signing step added to the task graph.
        storeFile = "some_name.keystore"
        storePassword = "your_password"
    }
}


Step 5: Go to your root folder of the project

$ cd ../../

Step 6: Build

$ ionic cordova build android --release

If successful you will get the following message
...
...
BUILD SUCCESSFUL

Total time: 45.593 secs
Built the following apk(s):
        path_root_folder/platforms/android/build/outputs/apk/android-release-unsigned.apk


Step 7: Sign the apk

$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore platforms\android\some_name.keystore platforms\android\build\outputs\apk\android-release-unsigned.apk some_name

Note: Add the location of the Android sdk build tools folder in the PATH Environment Variable.

Step 8: Zipalign

$ zipalign -v 4 platforms\android\build\outputs\apk\android-release-unsigned.apk Some_Name.apk


You will find the generated apk file in the root folder of your project. Generated apk file is now ready to be installed in your android phone.


7 comments:

  1. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.

    ionic training in chennai

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. A few refreshed telephone accompanying Android stage. More than 500K android apps for more than 500 android gadgets have overflowed by android advertise.
    A few refreshed telephone accompanying Android stage. More than 500K android apps for more than 500 android gadgets have overflowed by android advertise.https://appcloner.app
    https://appcloner.net

    ReplyDelete
  4. Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks auto reply text

    ReplyDelete
  5. Most of these applications are free. Some require you to upgrade by paying a small fee if you wish to get access to more advanced features. So what do you have to do to get files from the Market?
    app cloner

    ReplyDelete
  6. Cycling in Theth is something else!!! There is so much to see and to learn from Albania! Travel Albania

    ReplyDelete
  7. If you are looking for an inspirational walk than trekking in the trail of the old mills in Dhermi in Albania is a must-do. Albanian Cities

    ReplyDelete