How to Setup Cordova for Windows 7
Setup Cordova
Text Editor / IDE
You may need to prepare an IDE or Editor for working. Here for example, install a Sublime Text 3 over Windows, actually it contains versions of Mac OS as well as Linux.
Sublime Text 3
You may follow the following sites to install Sublime Test 3 and its plugins.
After install Package control. Then use
ctrl+shift+p
to open quick commands. Input
Install Package
and Enter you will find your favorate plugins and install with them.The Package Manager can be install in console. The console is accessed via the
ctrl+\
shortcut or the
View > Show Console` menu. Then put the below codes in and enter. Wait one minute... done!
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
CoffeeCompile
To configure to connect with coffee script, open in the menu Preference > Package Setting > CoffeeCompile > Settings - User
and edit with:
{
"coffee_path": "C:\\Users\\{{your-windows-user}}\\AppData\\Roaming\\npm\\coffee"
}
The Command-Line Interface
Instlaling the Requrements first
JDK
To download and install JDK. And configure environment as below. I Install JDK in C:\usr\opt\Java\jdk1.7.0_45
folder.
set JAVA_HOME=C:\usr\opt\Java\jdk1.7.0_45
set Path=%Path%;%JAVA_HOME%\bin
set classpath=.;%JAVA_HOME%\lib
Android SDK / ADT Bundle
To download and install Android SDK / ADT Bundle. And configure environments as below. I Instlal ADT Bundle in
C:\usr\opt\adt-bundle
, and an Eclipse IDE is prepared for you together with sdk.
set ADT_HOME=C:\usr\opt\adt-bundle
set Path=%Path%;%ADT_HOME%\sdk\platform-tools;%ADT_HOME%\sdk\tools
Ant
To download and install Ant. And configure environment as below. I install Ant in
C:\usr\opt\ant
folder.
set ANT_HOME=C:\usr\opt\ant
set Path=%Path%;%ANT_HOME%\bin
Installing the Cordova CLI
To install the cordova command-line tool, follow these steps:
Download and install Node.js. Following installation, you should be able to invoke node and npm on your command line. If desired, you may optionally use a tool such as nvm or nave to manage your Node.js installation.
Download and install a git client, if you don't already have one. Following installation, you should be able to invoke git on your command line. Even though you won't be using git manually, the CLI does use
it behind-the-scenes to download some assets when creating a new project.
Install the cordova module using npm utility of Node.js. The cordova module will automatically be downloaded by the npm utility.
on Windows:
C:\>npm install -g cordova
Create the App
$ cordova create hello com.example.hello HelloWorld
Add Platforms
Run any of these from a Windows machine, where wp refers to different versions of the Windows Phone operating system:
$ cordova platform add wp7
$ cordova platform add wp8
$ cordova platform add windows8
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
Run this to check your current set of platforms:
$ cordova platforms ls
Run either of the following synonymous commands to remove a platform:
$ cordova platform remove blackberry10
$ cordova platform rm amazon-fireos
$ cordova platform rm android
WARNING: When using the CLI to build your application, you should not edit any files in the /platforms/ directory unless you know what you are doing, or if documentation specifies otherwise. The files in this directory are routinely overwritten when preparing
applications for building, or when plugins are reinstalled.If you wish at this point, you can use an SDK such as Eclipse or Xcode to open the project you created. You will need to open the derivative set of assets from the /platforms/ directory to develop with an SDK. This is because the SDK specific metadata files
are stored within the appropriate /platform/ subdirectory. (See the Platform Guides for information on how to develop applications within each IDE.) Use this approach if you simply want to initialize a project using the CLI and then switch to an SDK for native work.Read on if you wish to use the cross-platform workflow approach (the CLI) for the entire development cycle.
Build the App
By default, the cordova create script generates a skeletal web-based application whose home page is the project's www/index.html file. Edit this application however you want, but any initialization should be specified as part of the deviceready event handler,
referenced by default from www/js/index.js.
Run the following command to iteratively build the project:
$ cordova build
This generates platform-specific code within the project's platforms subdirectory. You can optionally limit the scope of each build to specific platforms:
$ cordova build android
Test the App on an Emulator or Device
Run a command such as the following to rebuild the app and view it within a specific platform's emulator:
$ cordova emulate android
Alternately, you can plug the handset into your computer and test the app directly:
$ cordova run android
Add Plugin Features
The cordova plugin add command requires you to specify the repository for the plugin code. Here are examples of how you might use the CLI to add features to the app:
Basic device information (Device API):
$ cordova plugin add org.apache.cordova.device
Network Connection and Battery Events:
$ cordova plugin add org.apache.cordova.network-information
$ cordova plugin add org.apache.cordova.battery-status
Accelerometer, Compass, and Geolocation:
$ cordova plugin add org.apache.cordova.device-motion
$ cordova plugin add org.apache.cordova.device-orientation
$ cordova plugin add org.apache.cordova.geolocation
Camera, Media playback and Capture:
$ cordova plugin add org.apache.cordova.camera
$ cordova plugin add org.apache.cordova.media-capture
$ cordova plugin add org.apache.cordova.media
Access files on device or network
(File API):
$ cordova plugin add org.apache.cordova.file
$ cordova plugin add org.apache.cordova.file-transfer
Notification via dialog box or vibration:
$ cordova plugin add org.apache.cordova.dialogs
$ cordova plugin add org.apache.cordova.vibration
Contacts:
$ cordova plugin add org.apache.cordova.contacts
Globalization:
$ cordova plugin add org.apache.cordova.globalization
Splashscreen:
$ cordova plugin add org.apache.cordova.splashscreen
Open new browser windows (InAppBrowser):
$ cordova plugin add org.apache.cordova.inappbrowser
Debug console:
$ cordova plugin add org.apache.cordova.console
Updating Cordova and Your Project
After installing the cordova
utility, you can always update it to the latest version by running the following command:
$ sudo npm update -g cordova
Run a command such as the following for each platform you're building:
$ cordova platform update android
$ cordova platform update ios
...etc.
SEE ALSO
How to Setup Cordova for Windows 7的更多相关文章
- inno setup判断是Windows系统版本(其实还是Delphi代码,还能检查域控制器和家庭版)
1.设置Windows最低版本要求 [Setup]: MinVersion 格式: a.bb,c.dd,这里 a.bb 是 Windows 版本,c.dd 是 Windows NT 版本. 默认值: ...
- How to setup a native windows server 2003 tftpd
expand tftpd.ex_ %windir%\system32\tftpd.exe instsrv tftpd %windir%\system32\tftpd.exe reg add hklm\ ...
- Cordova - Windows版本图形界面管理工具,告别命令行输入方式!
Cordova本身提供的是命令行管理工具,并没有提供图形界面管理工具,虽然命令行管理工具可以完成所有Cordova管理,但是对于我这种懒蛋,可真不希望每次都输入命令,而且我更担心一旦输错一个字符,命令 ...
- Windows 上安装 Jekyll.
Jekyll是一个静态网站生成工具.它允许用户使用HTML.Markdown或Textile来建立静态页面,然后通过模板引擎Liquid(Liquid Templating Engine)来运行. 原 ...
- Windows Registry Security Check
catalog . Windows注册表 . Windows注册表包含的攻击向量 . 注册表安全配置基线标定 1. Windows注册表 注册表(Registry,繁体中文版Windows称之为登录档 ...
- cordova 学习笔记
0.sdk安装 http://spring.io/guides/gs/android/ 1.安装(node.js 需要安装https://nodejs.org/) on OS X and Linux: ...
- Selenium Grid 运行报错 Exception thrown in Navigator.Start first time ->Error forwarding the new session Empty pool of VM for setup Capabilities
Selenium Grid 运行报错 : Exception thrown in Navigator.Start first time ->Error forwarding the new se ...
- [!!!!!]Inno Setup教程-常见问题解答
[转]Inno Setup教程-常见问题解答 功能 * 翻译 Inno Setup 文字 * 它支持 MBCS (多字节字符集) 吗? * 将来会支持 Windows Installer 吗? ...
- 使用Inno Setup 打包.NET程序,并自动安装.Net Framework
使用Inno Setup 打包.NET程序,并自动安装.Net Framework http://www.cnblogs.com/xiaogangqq123/archive/2012/03/19/24 ...
随机推荐
- Cocos2d-x添加Android手机震动
这个震动需要调用adnroid系统的方法,所以需要C++调用java,JNI这里就不多做介绍了,需要的可以自己去查找下相关资料,如果你只是需要实现这个功能,相信你看完本文,应该就OK了! 1.首先,修 ...
- lua连续随机数
号外:惭愧,工作后几乎没有写博客了,其实是有时间的(每周单休),只是厌烦对着屏幕了,还有懒. 现在老板换人了,时间会多点,估计正常就每周双休了,决定还是每周写两篇(不一定是love2d), 写不出就翻 ...
- vue前端导出zip包
1. npm install jszip /npm install script-loader / npm install file-saver 2.功能代码 require('script-loa ...
- JAVA中的protected(详解),以及和clone()方法有关的一些问题
http://blog.csdn.net/ciawow/article/details/8262609 ************************************************ ...
- js异步加载的解决方案
默认情况javascript是同步加载的,javascript的加载时阻塞的,后面的元素要等待javascript加载完毕后才能进行再加载,如何解决这个问题呢,接下来将为你详细介绍下异步加载js三种实 ...
- LeetCode: Clone Graph 解题报告
Clone GraphClone an undirected graph. Each node in the graph contains a label and a list of its neig ...
- hive 进阶笔记
-- mysql方式 create table account_channel(account_ String,channel_ String) as select a.account,b.chann ...
- PHP 之前后端交互
今天想实现一个很简单的功能,前端上面一个按键去控制 板子里面的一个LED灯,就这么一个简单的问题,困扰了一天. 以前搞底层的时候,没有服务端和客户端的深刻概念,网页不同,分在客户端运行的 html 代 ...
- USB 驱动之 usb_register 函数解析
前段时间在kernel 添加了 USB to LAN 模块 AX88772B 的驱动. 根据相关添加解析一下 usb_register_driver 函数 drivers/net/usb/asix.c ...
- Android——用对话框做登陆界面(自定义对话框AlertDialog,多线程,进度条ProgressDialog,ListView,GridView,SharedPreferences存,读数据,存取文本,assets文件)
效果: 1.点击图标进入页面二 2.页面2图片暂停显示5秒进入页面三 3.点击页面三登陆按钮,打开登陆对话框,输入密码进入页面四 点击下载按钮,显示水平进度条 点击保存和获取用户名和密码 进入页面六 ...