Skip to content

berto-dev/cordova-installation-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 

Repository files navigation

CordovaInstall


INSTALLATION OF CORDOVA (UPDATE 2023)


A pipelines it's a simple step by step roles for make somethings better.
This file is a simple annotations for custom installation of basic environment for *cordova + cordova assets + extras*.

Important note: it's under costruction and based on personal use.

A simple flow for installation of ex asset for cordova
It's based on windows/linux workflow


- Install Andriod Assets (windows/linux):

(old way here)

  • install Java JDK (tested on windows) (under test in 2023) :

    • Gradle builder not support java major of v16 so... it's better to install: JDK v15 installer
      get the latest JDK resource *not recommended

    • SDK and tools:

      • download "Command line tools only" (it's on end of page) and copy it into "%ProgramFiles%\Android"
        open cmd (administrator) and enter in folder cd %ProgramFiles%\Android\cmdline-tools\bin and get list with sdkmanager --list, so digit sdkmanager "platform-tools" "platforms;android-NN" (NN is latest number you can see)
      • install android studio
      • copy Platform Tools into "%USERPROFILE%\AppData\Local\Android\sdk" (if not exist, make it)
      • lounch android studio and finish all standard sdk steps (or bypass it and go on next step)
      • install android SDK version and build tools from Android Studio:
        • Open AS, click on "more actions">"SDKMANAGER"
        • on left, find "Apparence">"System settings">"Android SDK"
        • select on SDK PLATFORM TAB "Android 10 (api level 29)"
        • select on SDK TOOLS TAB > "Android SDK Build Tools" > "30.0.3"
    • in windows: set JAVA_HOME / [article](https://tech.amikelive.com/node-533/how-to-install-java-sdk-on- windows/) (similar to step below)

      • Right click Computer
      • Click the properties
      • Select Advanced System Settings
      • Select Environment Variables:
        • on SYSTEM VARIABLE click new and add ANDROID_SDK_ROOT and %LOCALAPPDATA%\Android\sdk (put below all)
        • on SYSTEM VARIABLE click new and add ANDROID_HOME and %LOCALAPPDATA%\Android\sdk (put below all)
        • on SYSTEM VARIABLE click new and add JAVA_HOME and %ProgramFiles%\Java\jdk-15.0.2 (latest jdk have high risks of compatibility issue)
        • on SYSTEM VARIABLE click new and add JRE_HOME and %ProgramFiles%\Android\Android Studio\jre (put below all)
        • on SYSTEM VARIABLE click new and add _JAVA_OPTIONS and -Xmx512M or better: -Xmx4608m (or more memory)
        • on SYSTEM VARIABLE click on PATH and add:
          • %JAVAHOME%\bin
          • %ANDROID_SDK_ROOT%\platform-tools
          • %ANDROID_SDK_ROOT%\build-tools\33.0.1
            if necessary:
          • %LOCALAPPDATA%\Android\Sdk\tools\emulator
          • %LOCALAPPDATA%\Android\Sdk\cmdline-tools\latest\bin
      • open terminal and verify java -version
    • install gradle binary:

      • in linux:
        get it on: gradle.org/install "Binary-only" and set it "Linux & MacOS users" on page open env with: Step 3. Configure your system environment

      • in windows: gradle.org/install "Binary-only", rename folder in Grandle and copy it into "%ProgramFiles%\Gradle\bin" (or simple C: Grandle) and...

        • on SYSTEM VARIABLE click on PATH and add "%ProgramFiles%\Gradle\bin"
        • on terminal enter cd %ProgramFiles%\Gradle\bin and verify gradle -v
        • on terminal enter gradle help --scan for all dep issue
  • ANDROID SDK ASSET (in windows) (under test):
    /!\ NOT GET android 10 for retrocompatibility issue! Remain in 9 (the classic released in cordova installation) and...

    • download and open android studio;
    • click arrow on "More Actions" > SDKManager (OR ALTERNATIVE: SKD):
    • open android studio, go to "Android SDK", remove all SKD Platform and check only Android API 32 (Sv2) and Android9(Pie)
    • now on SDK Tools tab remove all! and check only 3.0.3 version.
    • test it in cleaned, new, cordova app with cordova build android; not recognized? cordova platform add [email protected] and readd the 9.1;
  • Install Node JS:

    • in windows:

      • get NVM and after reboot if system run command:
        :: nvm install --lts or nvm install latest
        after install:
        :: nvm use --lts or nvm use latest
        or run Node Installer
    • Check node istallation: $ node -v

    • check if NPM is installed: $ npm -v

    • if not installer run command: $npm install -g npm@latest

    • in linux:

    • find your distro command here, for Arch is: $pacman -S nodejs npm and nvm is in AUR


- Install IOS Assets:

  • via Apple PC:

    • install X-CODE

    • Install NVM:
      '$ ls -a and check if exist action profile ”zshrc”… if not: $ touch .zshrc'
      '$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash'
      '$ source .zshrc'
      '$ nvm'
      '$ nvm install node --lts'
      '$ nvm use node'
      '$ nvm -v && node -v && npm -vv'

    • Install Cordova and connect it to xcode:
      '$ num install cordova -g'
      '$ xcode-select --install'

    • Install brew and cocoa for iOS deploy:
      '$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
      '$ brew install ios-deploy'
      '$ sudo gem install cocoapods'

    • In your project, after install iOS platform, into platforms/iOS folder, you can find .xcodeproj and open it with Xcode by double click or command: '$ open ./platforms/ios/YOUR_APP_NAME.xcworkspace/'. I suggest a better way (prepare,update and open): '$ cordova prepare ios && open -a Xcode platforms/ios'

  • via virtual OS:
    Although it's only for compiling, I would recommend an hackintosh on a dedicated partition due the poor performance of vm or Apple Pc, however...


- Install Cordova Assets:


  • Cordova first assets:
    :: npm i -g cordova (or npm i -g [email protected] or 11.0.0 or other version)
    see all warning of audit fix, if you can...
    :: npm audit fix
    after repair all deprecated, check cordova
    :: npm cordova -v


  • first app:
    in project folder run:
    :: cordova create MYPROJECT com.MYPROJECT HelloWorld
    add platforms in your project:
    :: cordova platform add browser
    :: cordova platform add ios
    :: cordova platform add android


  • first adds:
    note: in theory the_ "--save"_ is deprecated; if "-dev" not work try "--production=false";

    • install [browser sync 2](cordova plugin add cordova-plugin-browsersync-gen2) for --live-reload:
      :: cordova plugin add cordova-plugin-browsersync-gen2 --save-dev
      rapid check... run cordova web server:
      :: cordova run --live-reload

        in case of windows security stop: "impossible to execute a script PS1 in Powershell"
        open in admin mode powershell and the system32 folder.
        now write:
      
        Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
      
        other option:
          restricted (probably currently)
          unrestricted
          remotesigned (good fo server and cordova)
          allsigned (not raccomended)```
      
      
    • install Policy Parse
      :: npm install csp-parse
    • install Cordova Cache
      :: npm i cordova-plugin-cache
    • install cleartext-traffic
      :: cordova plugin add cordova-plugin-enable-cleartext-traffic
    • install files
      :: cordova plugin add cordova-plugin-file
    • install battery status
      :: cordova plugin add cordova-plugin-battery-status
    • install Plug-Device
      :: cordova plugin add cordova-plugin-device
    • install Net Info
      :: cordova plugin add cordova-plugin-network-information
    • install Globalization
      :: cordova plugin add cordova-plugin-globalization
    • install Geo Localization
      :: cordova plugin add cordova-plugin-geolocation
    • install Vibration
      :: cordova plugin add cordova-plugin-vibration
    • install Whitelist (probably you not need of this after cordova 10)
      :: cordova plugin add cordova-plugin-whitelist
    • install browser
      :: `cordova plugin add cordova-plugin-inappbrowser``
    • install statusbar-settings
      :: `cordova plugin add cordova-plugin-statusbar``
    • if you can:
    • other possible:

  • open you project app folder and check config.xml and set basics inside similar to demo config.xml
    for make all icons see cordova-icon:
    :: npm install cordova-icon -g

  • use cordova init for launch app and plugin... and so add statuts bar and system info

  • ... waiting next ...


NOTES FOR PRODUCTION

  • IT BETTER TO START WITH IOS
  • ANDROID NEED IN cofing.xml xmlns:android="http://schemas.android.com/apk/res/android" in widget declaration

NOTES:

  • if you try to run a cordova commands (run, build, ecc) before add platforms from zero, Node don’t run that processes. The folder of node_modules need to be empty and refilled from scratch when you download process from hub.
  • Sometimes modules have a problems, try: git rm -r --cached node_modules
  • Other for distribution in App Store: https://www.youtube.com/watch?v=y8_CGVL9INM