Skip to content

Generate mobile distribution files

Harel M edited this page Jun 15, 2019 · 11 revisions

Android

In order to generate android apk file the following steps should be taken:

  • Install android studio - described here
  • [Optional] npm install cordova -g - this will install cordova cli tools globally to allow developing stuff related to cordova.
  • Go to IsraelHiking.Web folder and run using the command line:
    • cordova platform add android - this adds all the relevant plugins and platform needed in order to create the apk file. You'll need to run this only once at the beginning or if you update/add a plugin.
    • npm build:cordova - this will create the client code needed for cordova to use - run this every time you change the typescript/html/(s)css code
    • npm build-apk - this creates the unsigned apk file
    • Using powershell you can use the following command line to sign the app: Invoke-Expression "& ""$env:ANDROID_HOME\build-tools\28.0.2\apksigner.bat"" sign --ks .\IHM.jks --ks-key-alias ihmkey --ks-pass pass:<key-store-password> --key-pass pass:<key-password> --out signed.apk .\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk"
    • If you installed cordova globally you can also run cordova run android and it will create a debug apk and install it either on a simulator or on your device - if your device is plugged in and developer tools are allowed.

iOS

  • Make sure to setup the environment using this article
  • [Optional] sudo npm install cordova -g - this will install cordova cli tools globally to allow developing stuff related to cordova.
  • Go to IsraelHiking.Web folder and run using the command line:
    • in some cases node-sass is causes errors - to amend this run npm rebuild node-sass
    • npm run build:cordova
    • cordova platform add ios
    • open xcode and look for the xcodeproj inside platform\ios
    • Select "Generic iOS device" as a target
    • Click product → archive
    • The build might fail - to overcome it - click the root node - Israel Hiking Map
    • Under General uncheck automatic manage signing and recheck it again
    • Click product → archive again

Additional info here And more accurate here