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 theView > 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

Apache Cordova Document

How to Setup Cordova for Windows 7

时间: 2024-11-13 07:54:07

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 版本. 默认值: 4.0,4.0 描述:这个指令让你指定你的软件运行必须的 Windows 或 Windows NT 版本最小版本,要防止你的程序在 Windows 或 Windows NT 下运行,请在最小版本中的一个指定“0”.构建号和/或安全服务包级别可以包含在版本号中.如果用户系统不适合最小版本需求,安装程序

How to setup a native windows server 2003 tftpd

expand tftpd.ex_ %windir%\system32\tftpd.exeinstsrv tftpd %windir%\system32\tftpd.exereg add hklm\system\currentcontrolset\services\tftpd\Parametersreg add hklm\system\currentcontrolset\services\tftpd\Parameters /v Directory /t REG_SZ /d d:\tftpdmd c

Windows 上安装 Jekyll

Jekyll是一个静态网站生成工具.它允许用户使用HTML.Markdown或Textile来建立静态页面,然后通过模板引擎Liquid(Liquid Templating Engine)来运行. 原文链接:Setup Jekyll on Windows 目前,网上有许多Jekyll的安装方法,大都相似,为了方便更多准备学习Jekyll的人,特翻译如下: 共分为以下几个重要步骤 安装 Ruby 安装 DevKit 安装 Jekyll 安装 Pygments 安装 Python 安装 ‘Easy

Windows Registry Security Check

catalog 1. Windows注册表 2. Windows注册表包含的攻击向量 3. 注册表安全配置基线标定 1. Windows注册表 注册表(Registry,繁体中文版Windows称之为登录档)是Microsoft Windows中的一个重要的数据库,用于存储系统和应用程序的设置信息.早在Windows 3.0推出OLE技术的时候,注册表就已经出现.随后推出的Windows NT是第一个从系统级别广泛使用注册表的操作系统.但是,从Microsoft Windows 95开始,注册表

使用Inno Setup 打包.NET程序,并自动安装.Net Framework

使用Inno Setup 打包.NET程序,并自动安装.Net Framework http://www.cnblogs.com/xiaogangqq123/archive/2012/03/19/2405730.html Inno Setup是什么 Inno Setup 是一个windows系统下的安装包制作程序.它是免费的(而且允许免费用于商业用途).官网网站:http://www.jrsoftware.org/ 虽然说.NET 可以使用VS来打包安装包,但可定制化绝对不如Inno Setup

命令行添加用户的“作为服务登录”权利(添加Windows用户的时候,门道不是一般的多)good

1.打开控制台(“开始”|“运行”中输入:MMC) 2.“文件”菜单|“添加删除管理单元”|“添加...”|选“安全模板”|“关闭”. 3.在“C:\Windows\Security\templates”节点上,右键“新建模板...”,在弹出的对话框中“模板名”中输入:new,确定. 4.打开“New|本地策略|用户权利指派”节点,在右侧的“作为服务器登录”中添加要赋予该权限的用户. 5.然后,在“New”节点上单击右键,选“另存为...”保存到“C:\Sec.inf”. 6.建立批处理文档中输

tomcat学习(-)windows 7 x64 配置tomcat服务

下载Tomcat 下载地址:http://tomcat.apache.org/ 安装版本:Tomcat 9.0 安装环境:windows 7 x64 阅读Tomcat文档 文档路径:http://localhost:8080/docs/setup.html 找到windows安装的部分,看下说明:点击蓝色 Windows Service HOW-TO 部分,进入安装. 找到路径:http://tomcat.apache.org/tomcat-9.0-doc/windows-service-how

华宇集成4组windows学习月每日一个知识点(1-10)

3.29windows学习月(一).windows知多少 连接地址 http://11287958.blog.51cto.com/11277958/1757569 3.29windows学习月(二) 现在流行的raid配置有raid0,1,5,6,他们都有什么优缺点? 3.29windows 学习月(二),大家共同努力,有了以下结果:RAID0:N块盘组成,容量为N块盘容量之和,所有硬盘同时读写,速度最快,无冗余RAID1:两块盘组成,容量为一块盘容量,一块是另一块盘的镜像盘,容量减少一半,速度

Windows Server 2016 Volume Activation Tips

This is Scott McArthur, a Supportability Program Manager for Windows and Surface. With the launch of Windows Server 2016 I wanted to share some information on volume activation: Updating your existing KMS hosts to support Windows Server 2016 Setting