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.


10 comments:

  1. This comment has been removed by the author.

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

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

    ReplyDelete
  4. What style shoe should I wear? Is this my correct size? How can I tell if the shoes are really well made? These questions and many more must be answered each time a pair of shoes is selected and bought. Giày Balenciaga speed trainer

    ReplyDelete
  5. Shoes are an essential fashion accessory for both men and women alike. It is important that we have a few pair of shoes that are considered essential for our daily use. These include, formal shoes (preferably black or brown), casual shoes, walking shoes and running shoes. When shopping for shoes, you should always choose the best, for the sake of your feet, and choose something that you can wear for different occasions. Designer shoes are always the best choice, especially when it comes to buying shoes for your personal use (as opposed to just gifts). Giày MLB

    ReplyDelete
  6. If you're in the market for a pull behind travel trailer, it's important to investigate the materials from which the trailers are made. The material can make a decisive difference in fuel efficiency and overall longevity of the trailer. Typically, you'll see articles comparing steel versus aluminum. This article will discuss the differences between aluminum trailers and fiberglass trailers and how these types of materials could affect the pull behind your motorcycle. Ios Hacker

    ReplyDelete
  7. Welcome to a new phenomenon in online retailing "Social Shopping." This term has been used more and more in the past few months to describe the future of online shopping. This post provides some practical examples where online retailers can start thinking about implementing these concepts on their platforms insulated backpack

    ReplyDelete
  8. I read your post and got it quite informative. I couldn't find any knowledge on this matter prior to. I would like to thanks for sharing this article here.android app development software in Chennai

    ReplyDelete
  9. I need to thank you for this very good read and i have bookmarked to check out new things from your post. Thank you very much for sharing such a useful article and will definitely saved and revisit your site.
    Hire Dedicated Ionic Developers

    ReplyDelete