Skip to content

Instantly share code, notes, and snippets.

@dohsimpson
Last active January 5, 2018 15:00
Show Gist options
  • Save dohsimpson/6df8c02aa4704be38d1d2927dbb2d701 to your computer and use it in GitHub Desktop.
Save dohsimpson/6df8c02aa4704be38d1d2927dbb2d701 to your computer and use it in GitHub Desktop.
Develop Mobile Apps with Cordova
## Javascript Package
* npm install/update [-g (install globally, otherwise in $PWD/node-modules dir)] PACKAGE
## Cordova CLI (ref: https://cordova.apache.org/docs/en/latest/reference/cordova-cli/)
* cordova <command> [options] -- [platformOpts]
* verbose output: -d
## Cordova Project
* dirs: config.xml hooks/ platforms/ plugins/ www/
## Cordova Project Getting Started
1. cordova create PROJECT_NAME [ID: com.companyname.appname] [NAME: app name appeared on device]
2. cordova platforms add browser/android/ios...
3. (Browser) cordova serve
4. (Android) Create default emulator (quite a chore, only need to done once: https://stackoverflow.com/questions/4974568/how-do-i-launch-the-android-emulator-from-the-command-line)
5. cordova build [PLATFORM]: prepare and compile
* cordova prepare [PLATFORM]: this will copy www/ to platforms/
* cordova compile [PLATFORM]: binary
6. cordova emulate [PLATFORM]: build and send to emulator
7. cordova run [PLATFORM]: build and send to device
8. Remote Debugging: (https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)
9. (Android) error: "Could not find an installed version of Gradle either in AndroidStudio", solution: install gradle on your OS, even you have AndroidStudio
## Develop
* cordova plugin add PLUGIN
* build relase build (unsigned): cordova build [android] --release
* make keystore: keytool -genkey -v -keystore KEYSTORE_NAME.keystore -alias ALIAS_NAME -keyalg RSA -keysize 2048 -validity 10000
* will prompt for password and info
* build release build (signed): cordova build [android] --release -- --keystore='../XXXXXX.keystore' --storePassword='XXXXXX' (keystore password) --alias='XXXXXX' --password='XXXXXX' (key password)
* NOTE: all arguments are required, if password not supplied, cordova fails without prompting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment