cordova 学习笔记

0.sdk安装

http://spring.io/guides/gs/android/

1.安装(node.js 需要安装https://nodejs.org/)

on OS X and Linux:
   $ sudo npm install -g cordova

on Windows:
   C:\>npm install -g cordova
$ sudo npm install -g cordova@3.1.0-0.2.0 安装指定版本

 2.创建

# hello  项目目录(不存在会自动创建)
# com.cc.hello 反向domain标示 (可选)
# HelloWord 应用程序的标题(可选)
$ cordova create hello com.cc.hello HelloWorld

3.添加platform

#切换到项目目录
$ cd hello
#add platform on mac
$ cordova platform add ios
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos

#add platform on window
$ cordova platform add wp8
$ cordova platform add windows
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos

4.检查platforms

$ cordova platforms ls
本机输出效果
Installed platforms: android 4.0.2, firefoxos 3.6.3, ios 3.8.0, windows 4.0.0, wp8
Available platforms: amazon-fireos, blackberry10, browser, windows8

5.编译(cordova 5.1.1 的sdk需要android-22) 

$ cordova build android

6.起模拟器(avd 配置 no system images installed for this target  haxm error)

$ cordova emulate android 
#to deploy the app on a connected device
$ cordova run android --device
 
cordova run ios --list to see all available targets and cordova run ios --target=target_name to run application on a specific device or emulator (for example, cordova run ios --target="iPhone-6")

 

7.运行app

$ cordova run android

8.android studio 设置sdk

9.插件管理

#安装plugman
$ npm install -g plugman

#安装plugin
$ cordova plugin add cordova-plugin-battery-status

#移除plugin
$ cordova plugin remove cordova-plugin-battery-status

#a platform install plugin
$ E:\hello>plugman -d install --platform android --project E:\hello\platforms\android --plugin cordova-plugin-battery-status

#remove plugin 
$ E:\hello>plugman -d uninstall --platform android --project E:\hello\platforms\android --plugin cordova-plugin-battery-status

10.app name

ios:xcode中选中项目,修改ProductName 

posted on 2015-07-03 09:58  BarneyZhang  阅读(558)  评论(0编辑  收藏  举报

导航