Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 21, 2022 04:23 am GMT

How to build an Ionic App using Cordova in windows (in 1st Attempt)

How to build a Ionic app using Cordova in windows

Prequsites :

  1. Install Andorid studio, JDK (preferd version 1.8), gradle.

    TricksAfter installed Android studio build a native hello world app and run it through Emulator or physical device for the first time. It will automatically gives you the support of installing gradle & reduce much time to installing & finding gradle version compability.
  2. Checking this info you can run java --version

    java version "1.8.0_321"Java(TM) SE Runtime Environment (build 1.8.0_321-b07)Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)
  3. After install JDK you will get a path in your machine like this C:\Program Files\Java or C:\Program Files (x86) you able to see this two folder path.

    jdk1.8.0_321jre1.8.0_321
  4. Update environment variable

    // Add these in User Variables :ANDROID_HOME : C:\Usersheanam\AppData\Local\Android\SdkANDROID_PLATFORM_TOOLS : C:\Usersheanam\AppData\Local\Android\Sdk\platform-toolsANDROID_TOOLS : C:\Usersheanam\AppData\Local\Android\SdkoolsJAVA_HOME : C:\Program Files\Java\jdk1.8.0_321//Add these in System Variables path:C:\Program Files\Java\jre1.8.0_321\bin  // Otherwise you will get Jarsigner is not recognized internal or external commandC:\Program Files\Java\jdk1.8.0_321\bin // Otherwise keytool is not recognized internal or external commandC:\Program Files (x86)\Common Files\Oracle\Java\javapathC:\gradle-7.4.1\bin  // If path not found installed it.

Ionic App build stage & Signing unsigned apk

  1. Go to the App Folder
  2. Open terminal in that folder.
  3. Run keytool -genkey -v -keystore HERE_YOUR_KEY_NAME-key.keystore -alias HERE_YOUR_APP_ALIAS_NAME -keyalg RSA -keysize 2048 -validity 10000. You will find a keystore file is generated in your app folder.
  4. Run ionic cordova build android --prod --release --verbose
   After successfully executed this command you will get a message like this,   Built the following apk(s):       D:\xyz\ion-cordova\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk   It generate an unsigned apk that you never install in a phone so need to sign this apk.
  1. Run jarsigner --verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore HERE_YOUR_KEY_NAME-key.keystore "D:\xyz\ion-cordova\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk" HERE_YOUR_APP_ALIAS_NAME it will start signing this apk.

Now you are happy to go with the APP.

Signing Off
Sefat


Original Link: https://dev.to/sefatanam/how-to-release-an-ionic-app-using-cordova-in-windows-in-1st-attempt-3fh4

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To