helloworld2, 由于Eclipse太耗费资源了,也习惯了VIM开发,命令行编译,依据下面网址中文章所述,摘出命令行编译发布方法:
http://qt-project.org/wiki/Setting-up-Qt-Creator-for-BlackBerry-and-QNX 注: 以下内容全是Windows 7下面试验的.
1. 下载安装
BlackBerry 10 Native SDK2. 下载安装
BlackBerry 10 Dev Alpha Simulator3. 申请
BlackBerry Signing code keys 现在我们假设Simulator已经启动了,BlackBerry 10 Native SDK(以后简称为BBNDK)安装在了D:\bbndk目录下
4. 在Simulator中开启开发者模式
Settings->Security and Privacy->Development Mode
5. 新建一个快捷方式到桌面(或开始菜单等),命令为:
%COMSPEC% /k "D:\bbndk\bbndk-env.bat"
然后双击这个快捷方式,打开一个命令行,这里已经将BBNDK的许多环境变量都设置好了,之后的过程,全部是在这个命令行里处理
6. 注册csj,这里要填入前面申请csj时的PIN和邮件中收到的两个.csj文件, storepass自己设定好,后面要用
$blackberry-signer -register -csjpin <csj pin> -storepass <KeystorePassword> <client-RDK-xxxxxx.csj file> <client-PBDT-xxxxx.csj file>
7. 生成debug token,这里要输入的device PIN,可以从Simulator中的Settings->About->Hardware下找到,debug_token_file_name.bar自己定
$blackberry-debugtokenrequest -storepass <KeystorePassword> -devicepin <device PIN> <debug_token_file_name.bar>
8. 安装debut token到设备或Simulator, Simulator的IP地址可以在模拟器底部看到,没有密码。
$blackberry-deploy -installDebugToken <path to debug token file> -device <IP address of device> -password <device password>
经过上面的步骤,整个开发环境就搭配好了,下面开始写hello world
[可直接使用QtCreator创建一个Qt Quick 1 Application的项目,这样省事些,假设我们创建的示例路径为D:\hellworld, 那么下面是修改hello world过程
9. 创建bar-description.xml文件,放到D;\helloworld目录下
- <?xml version='1.0' encoding='utf-8' standalone='no'?>
- <qnx xmlns="http://www.qnx.com/schemas/application/1.0">
- <id>com.myapp.hellworld</id>
- <name>helloworld</name>
- <versionNumber>1.0.0</versionNumber>
- <description>This is my first hellworld app on blackberry</description>
- <initialWindow>
- <systemChrome>none</systemChrome>
- <transparent>false</transparent>
- <autoOrients>true</autoOrients>
- <aspectRatio>landscape</aspectRatio>
- </initialWindow>
- <env var="QML_IMPORT_PATH" value="app/native/imports"/>
- <env var="QT_PLUGIN_PATH" value="app/native/plugins:/usr/lib/qt4/plugins"/>
- <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib/"/>
- <action system="true">run_native</action>
- <configuration name="Simulator-Release">
- <platformArchitecture>x86</platformArchitecture>
- <asset path="helloworld" entry="true" type="Qnx/Elf">helloworld</asset>
- </configuration>
- <configuration name="Simulator-Debug">
- <platformArchitecture>x86</platformArchitecture>
- <asset path="helloworld" entry="true" type="Qnx/Elf">helloworld</asset>
- </configuration>
- <!-- 如果有真机,则去掉这个注释
- <asset type="Qnx/Elf" path="helloworld" entry="true">helloworld</asset>
- -->
- <asset path="qml">qml</asset>
- </qnx>
10. 开始编译过程,debug还是release自己定
如果是Simulator:
- $qmake -spec blackberry-x86-qcc "CONFIG+=simulator debug"
- $make
如果是真机:
- $qmake "CONFIG+=release"
- $make
经过上面的步骤,此时已经生成了hellworld文件,下面我们需要签名、打包、安装等过程
11. 生成安装包
可以以开发者模式生安装包
- $ blackberry-nativepackager -devMode -package helloworld.bar bar-descriptor.xml -debugToken <debug_Token_file.bar>
也可以以签名方式生成安装包并签名
- $ blackberry-nativepackager -package helloworld.bar bar-descriptor.xml
- $ blackberry-signer -storepass <KeyStorePassword> helloworld.bar
12. 将软件发布到device或simulator(手头没真机,当然是安装到simulator了
$ blackberry-deploy -installApp -package helloworld.bar -device <device_ip> -password <device_password>
如果要删除,则执行下面命令:
$ blackberry-deploy -uninstallApp -package helloworld.bar -device <device_ip> -password <device_password>
下面是运行效果:
