原文链接:Get started Guide for BlackBerry
原文有错误,博主针对PhoneGap 1.3.0对原文做了小的修正,用红色底色标注。
-
1. Requirements
- Windows XP (32-bit) or Windows 7 (32-bit and 64-bit) or Mac OSX 10.6.4+
For 4.x devices check out this guide.
-
2. Install SDK + PhoneGap
(Windows Only) Download and install Sun JDK (32-Bit Version). Add it to your PATH variable.
(Windows Only) Download and extract Apache Ant. Add it to your PATH variable.
Download BlackBerry WebWorks Smartphone SDK for BlackBerry development and/or BlackBerry WebWorks Tablet OS SDK for Playbook development. Keep note of the directories you install these SDKs.
Download the latest copy of PhoneGap,downloadthe latest copy of PhoneGap BlackBerry template(例如文件 callback-phonegap-1.3.0-0-gb81151f.zip)
-
3. Setup New Project
- Open up a command prompt/terminal and navigate to where you extracted PhoneGapBlackBerry template. CD into the PhoneGap BlackBerry directory.
- Create a PhoneGap BlackBerry and PlayBook project. Type
ant create -Dproject.path=
followed by the location you wish to create your project into the command prompt/terminal. (例如 e.g. > ant create -Dproject.path=C:\Dev\bbw\sample
) - Change to the newly created directory located at
C:\Dev\bbw\sample
. - Open up the project.properties file with your favourite editor and change the lines
BlackBerry.bbwp.dir=
andPlayBook.bbwp.dir=
to equal the respective install locations of the SDKs you downloaded earlier.
-
4. Hello World
Build the PhoneGap sample project by typing
ant target build
(例如 ant blackberry build )in your command prompt/terminal while you are in your project's directory. Replace the target with either blackberry or playbook. Note this is the sample PhoneGap project and not a basic hello world application. You can go edit the index.html file located in the www directory of your project to make it say Hello World if you wish. -
5A. Deploy to Simulator (Windows Only)
- While in your project directory, in command prompt/terminal type
ant target load-simulator(例如e.g. >ant blackberry load-simulator)
. Replace the target with either blackberry or playbook. - Press the BlackBerry button on the simulator, go to downloads and you should see your app loaded there.
- While in your project directory, in command prompt/terminal type
-
5B. Deploy to Device (Windows and Mac)
- You have to have your signing keys from RIM by filling out this form.
- While in your project directory, in command prompt/terminal type
ant target load-device
. Replace the target with either blackberry or playbook.(例如e.g. >ant blackberry load-
device
) - Press the BlackBerry button on the simulator, go to downloads and you should see your app loaded there.
=========================================
注释:BlackBerry WebWorks For Smartphones最新版本为BlackBerry WebWorks SDK 2.2里面的BlackBerry模拟器已经升级为OS 7.0的9930。
编辑project.properties
修改如下三行
blackberry.bbwp.dir=D:\\Research In Motion\\BlackBerry WebWorks SDK 2.2
blackberry.sim.dir=D:\\Research In Motion\\BlackBerry WebWorks SDK 2.2\\simpack\\7.0.0.318
blackberry.sim.bin=9930.bat