Cordova

APP BUILDING & KNOW ISSUES

By Cường Trần / cuongtran3001@gmail.com

OVERVIEW

Create mobile app with HTML, CSS and JS

 

Target multiple platform with one code bas e

 

Free and open source

Installing

Install

npm install -g cordova

Create simple app

Create the HelloWorld app in helloworld folder with package named: com.example.hello:

 

cordova create helloworld com.example.hello HelloWorld

Create simple app

Add platforms:

cordova platform add ios --save

cordova platform add android --save

...

SHOUDN'T EDIT ANY FILE IN /platforms/ folder

Create simple app

ANDROID Pre-requisites installing:

 

http://cordova.apache.org/docs/en/6.x/guide/platforms/android/index.html

 

JAVA JDK -  ANDROID SDK - ANDROID TARGETS - GRADLE

 

Create simple app

Create simple app

ANDROID Pre-requisites installing:

 

ANDROID SDK: https://developer.android.com/studio/index.html install SDK only

 

=> ANDROID_HOME environment variable setting

 

ANDROID_HOME PATH setting:

          %ANDROID_HOME%\tools

          %ANDROID_HOME%\platform-tools

Create simple app

ANDROID Pre-requisites installing:

 

ANDROID TARGETS: run @\android-sdk\SDK Manager.exe

Create simple app

ANDROID Pre-requisites installing:

 

GRADLE: https://gradle.org/gradle-download/?_ga=1.144141872.484234549.1479366743

 

 

 

 

Configure  Gradle distriburionsUrl to local package:

//Get SDKMAN!
curl -s https://get.sdkman.io | bash

//Install Gradle
sdk install gradle 3.2
//platforms\android\cordova\lib\builders\GradleBuilder.js
var distributionUrl='file\:///DISK_NAME:/PATH/TO/gradle-x.xx.xx-all.zip';

Create simple app

ANDROID Pre-requisites installing:

 

Setting up an Emulator

 

 

 

 

Configure  Gradle distriburionsUrl to local package:

//Get SDKMAN!
curl -s https://get.sdkman.io | bash

//Install Gradle
sdk install gradle 3.2
//platforms\android\cordova\lib\builders\GradleBuilder.js
var distributionUrl='file\:///DISK_NAME:/PATH/TO/gradle-x.xx.xx-all.zip';

Create simple app

Build the app:

cordova build        //build all platforms

cordova build ios    //build for ios platform only

cordova build [<platform> [...]]
    [--debug|--release]
    [--device|--emulator]
    [--buildConfig=<configfile>]
    [--browserify]
    [-- <platformOpts>]

Create simple app

Test the app:

cordova emulate android

Manage platform & plugin version

Can change by command line or config.xml

 

Allow to save & restore app to check all platforms and plugins

 

Easy to work with large team 

Manage platform & plugin version

Platform:

cordova platform add <platform[@<version>] | directory | git_url> --save

cordova platform save

cordova platform update <platform[@<version>] | directory | git_url> --save

cordova platform remove <platform> --save

Q&A

Cordova

By Cường Trần

Cordova

Cordova App Building

  • 529