您的位置:首页 > 其它

PhoneGap 2.0.0安装,命令行构建,编译BlackBerry项目,并部署到手机上

2012-07-21 23:24 477 查看
Q: 问什么命令行编译啊,不online编译,不用Ripple编译?
A:  PhoneGap 2.0.0版本在2012.07.20发布,build.phonegap.com目前只支持到1.9.0,Ripple只支持1.0。

====================================================
下载安装:JDK 1.6
set JAVA_HOME=C:\TOOLS\JDK1.6
set PATH=%JAVA_HOME%\bin;%PATH%

测试:java -version
返回结果:
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
====================================================

下载解压缩:apache-ant-1.8.2
set ANT_HOME=C:\Phonegap\apache-ant-1.8.2
set PATH=%ANT_HOME%\bin;%PATH%

测试:ant.bat
返回结果:
Buildfile: build.xml does not exist!
Build failed
====================================================

启用cscript(我的Windows 7没有启用),修改完毕注册表后,不用重新启动机器,直接重新打开一个新的dos窗口即可运行cscript. http://answers.yahoo.com/question/index?qid=20110529123006AABGsYv
测试:cscript
返回结果:
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Usage: CScript scriptname.extension [option...] [arguments...]

====================================================
下载zip文件

PhoneGap 2.0.0 Released 20 Jul 2012 http://phonegap.com/download/
解压缩后的目录结构:
Directory Structure
-------------------

 |-doc/ ........... source documentation
 |-lib/ ........... platform code for supported operating systems
 | |-android/
 | |-bada/
 | |-blackberry/
 | |-ios/
 | |-symbian/
 | |-webos/
 | '-windows/
 |-changelog ..... a changelog compiled from comments and authors
 |-license ....... the Apache Software License v2
 |-version ....... release version in plain text
 '-readme.md ..... release readme

====================================================
在PhoneGap 2.0.0的BlackBerry相应目录下执行create.bat
cd C:\Phonegap\phonegap-phonegap-20120720\lib\blackberry\bin
create  \phonegap\opath -phonegap-blackberry opath

其中:
项目目录 c:\phonegap\opath -phonegap-blackberry
项目名称:opath

结果:生成目录结构C:\Phonegap\opath-phonegap-blackberry
 cordova
 lib
 www
 playbook.xml
 project.properties
 blackberry.xml
 build.xml

====================================================

修改 project.properties中的和BlackBerry相关的参数
blackberry.bbwp.dir=C:\\RIM\\BlackBerry WebWorks SDK 2.3.1.5

blackberry.sigtool.password=passw0rd

blackberry.sim.password=qwer

====================================================
修改www目录下面的BlackBerry WebWorks配置文件:config.xml

修改
<name>cordovaExample</name>

增加
<author>Jiang Yang</author>

====================================================

在PhoneGap 2.0中,执行create.bat后生成的项目目录中有个文件build.xml,你可以执行ant 脚本 命令行构建项目。
例如:为BlackBerry手机构建cod文件。
ant blackberry build
例如:应用签名,并安装到手机上。

ant blackberry load-device

====================================================
完整参数列表:
     NAME
       Build and Deploy a Cordova BlackBerry WebWorks Project
     
     SYNOPSIS
       ant TARGET COMMAND [-D<argument>=<value>]...
     
     DESCRIPTION
       You can build and deploy your project to a device or simulator.
     
     TARGETS
       blackberry ........ Builds a cod file and deploys to a device or simulator
     
       playbook .......... Builds a bar file and deploys to a device or simulator
     
     COMMANDS
       help .............. Show this help menu.
                             ant, ant help
     
       load-device ....... Builds and deploys project to a connected USB device.
                             ant load-device
     
       load-simulator .... Builds and deploys project to default simulator.
                             ant load-simulator
     
       build ............. Compiles and packages the project for deployment.
                             ant build
     
       clean ............. Remove all files from the build/ directory.
                             ant clean
     
       clean-device ...... Remove this project from the connected USB device.
                             ant clean-device
     
       clean-simulator ... Remove this project from the simulator (takesa while).
                             ant clean-simulator
GETTING STARTED
  1. Edit project.properties
  2. ant blackberry load-simulator to run the project on the simulator
  3. Customize your project by editing www/config.xml
  4. To run the project on a BlackBerry device, you will need to obtain
     code signing keys from RIM. Once you have the key, a project is
     installed by connecting a BlackBerry via USB and running
    ant blackberry load-device

参考:
http://docs.phonegap.com/en/2.0.0/guide_command-line_index.md.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐