How to Setup Cordova for Windows 7

本文详细介绍了如何在Windows环境下使用Sublime Text 3安装配置Cordova开发环境,包括安装Sublime Text 3、安装Package Control、配置连接CoffeeScript、安装Java Development Kit (JDK)、下载并安装Android SDK/ADT Bundle、安装Ant等步骤,并提供了Cordova CLI的安装方法及应用流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

CH341A编程器是一款广泛应用的通用编程设备,尤其在电子工程和嵌入式系统开发领域中,它被用来烧录各种类型的微控制器、存储器和其他IC芯片。这款编程器的最新版本为1.3,它的一个显著特点是增加了对25Q256等32M芯片的支持。 25Q256是一种串行EEPROM(电可擦可编程只读存储器)芯片,通常用于存储程序代码、配置数据或其他非易失性信息。32M在这里指的是存储容量,即该芯片可以存储32兆位(Mbit)的数据,换算成字节数就是4MB。这种大容量的存储器在许多嵌入式系统中都有应用,例如汽车电子、工业控制、消费电子设备等。 CH341A编程器的1.3版更新,意味着它可以与更多的芯片型号兼容,特别是针对32M容量的芯片进行了优化,提高了编程效率和稳定性。26系列芯片通常指的是Microchip公司的25系列SPI(串行外围接口)EEPROM产品线,这些芯片广泛应用于各种需要小体积、低功耗和非易失性存储的应用场景。 全功能版的CH341A编程器不仅支持25Q256,还支持其他大容量芯片,这意味着它具有广泛的兼容性,能够满足不同项目的需求。这包括但不限于微控制器、EPROM、EEPROM、闪存、逻辑门电路等多种类型芯片的编程。 使用CH341A编程器进行编程操作时,首先需要将设备通过USB连接到计算机,然后安装相应的驱动程序和编程软件。在本例中,压缩包中的"CH341A_1.30"很可能是编程软件的安装程序。安装后,用户可以通过软件界面选择需要编程的芯片类型,加载待烧录的固件或数据,然后执行编程操作。编程过程中需要注意的是,确保正确设置芯片的电压、时钟频率等参数,以防止损坏芯片。 CH341A编程器1.3版是面向电子爱好者和专业工程师的一款实用工具,其强大的兼容性和易用性使其在众多编程器中脱颖而出。对于需要处理25Q256等32M芯片的项目,或者26系列芯片的编程工作,CH341A编程器是理想的选择。通过持续的软件更新和升级,它保持了与现代电子技术同步,确保用户能方便地对各种芯片进行编程和调试。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值