Ubuntu Phone应用开发环境搭建
来源:互联网 发布:日本读研 知乎 编辑:程序博客网 时间:2024/06/10 00:22
我运行的系统是Ubuntu12.10-32版本。所以文中没有特提及,默认系统为Ubuntu12.10-x64
首先安装Ubuntu SDK
Ubuntu SDK安装官方文档
依次执行以下命令
安装缺少的库
$sudo apt-get install libbotan*
安装qt5的源
$sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-proper
安装ubuntu sdk preview 的源
$sudo add-apt-repository ppa:ubuntu-sdk-team/ppa
更新缓存
$sudo apt-get update
安装 ubuntu sdk$sudo apt-get install ubuntu-sdk notepad-qml
过程所有需要回车的地方,直接回车就行。
如果在执行 sudo apt-get update 处出现错误,则去除 source.list 中对应的项,或者在软件中心的软件源设置中不启用错误源,重新执行 sudo apt-get update
安装完成之后,dash主页中输入 qt ,就会出现一个qtceator的程序图标,点击启动即可。
如果出现如图界面则安装正确。
![image][qtcreator]
安装phablet flash tool
执行以下命令,
添加phablet flash tool的软件源
$sudo add-apt-repository ppa:phablet-team/tools
更新缓存
$sudo apt-get update
安装phablet flash tool, adb 和 fastboot
$sudo apt-get install phablet-tools android-tools-adb android-tools-fastboot
这一个步骤的核心是为了能够,在后面使用QtCreator的时候,能够用adb连接手机设置手机的环境。
终端中执行
$adb devices
如果 List of devices attached 下面出现一串数字,则说明adb能够识别手机。 如下图
![image][adbdevices]
设置手机
同时按ctrl+alt+t三个键打开终端,依次执行以下命令
$adb root
$adb shell
执行完这两条命令之后,就进入了手机的android文件系统内。你可以使用ls命令查看下目录结构,就明白了。
进入ubuntu环境$ubuntu_chroot shell
提示符应该变为了 root@localhost ,则说明你以上步骤都执行正确了。如果是root@android ,则说明你还在android shell中
手机连接无线
此处指的是wifi,而非3G/2G无线
使用下面命令查看ip地址
$ip addr
如果要使用ifconfig命令查看ip地址的话,则需要执行 sudo mount -t proc proc /proc
$ip addr
最低下的 wlan0 中的 inet ,即为手机的ip地址
![image][wlan0]
安装openssh server
$sudo apt-get install
因为是要联网才能够安装openssh-server,所以要先用手机连接wifi。 如果wifi信号不好,就重新启动手机,再次执行上面的命令,通过adb进入手机。
再使用命令切换成phablet
#su phablet
注意 phablet用户的密码就是phablet,如果是平板,则为登录账户名字(first name)的小写字母
忘了说了 以上命令都是用usb连接手机之后,通过adb操作手机的。请注意。
安装app 到手机
启动 Qt Creator,新建一个工程取名”HelloUbuntuPhone”
工程向导中选择,Ubuntu-》Ubuntu UI Sample-》给工程取名,之后一直next.
添加HelloUbuntuPhone.desktop
文件内容如下
[Desktop Entry]Encoding=UTF-8Type=ApplicationTerminal=falseExec=/usr/bin/qmlsceneName=HelloUbuntuPhoneGenericName=HelloUbuntuPhoneComment=My first Ubuntu applicationIcon=ubuntu-qmlrunner
修改HelloUbuntuPhone.qml为你想要的
//HelloUbuntuPhone.qmlimport QtQuick 2.0import Ubuntu.Components 0.1/*! \brief MainView with a Label and Button elements.*/MainView { // objectName for functional testing purposes (autopilot-qt5) objectName: "mainView" applicationName: "HelloUbuntuPhone" width: units.gu(100) height: units.gu(75) Text { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top font.pointSize: 25 text: "Hello Ubuntu Phone--thuai" } Column { anchors.centerIn: parent width: units.gu(40) spacing: units.gu(2) Label { id: label objectName: "label" text: "Hello.." } Button { objectName: "button" width: parent.width text: "Tap me!" onClicked: { label.text = "..world!" } } Button { objectName: "quitBtn" text: "exit" width: 100 height: 100 onClicked: { Qt.quit() } } }}
用usb连接手机和电脑。手机必须连接wifi,这样才能够通过ssh启动程序进行调试。
按 ctrl+F11 ,连接手机与QtCreator
按 ctrl+F12 ,运行程序。
需要注意的是 程序启动很慢,然后响应的话,并不是很好。 相信后面Ubuntu SDK 升级之后,应该会好很多。
我所用的开发系统环境是Ubuntu12.10. 32位。 Vmware 8.0.3 Qt Creator 2.6.82. Qt 5.0.0
- Ubuntu Phone应用开发环境搭建
- Windows phone应用开发初体验(环境搭建+helloworld)
- [Windows Phone] Windows Phone开发环境搭建
- windows phone开发环境搭建
- Windows Phone 开发环境搭建
- Windows Phone开发环境搭建
- Phone 7 开发环境搭建
- Windows Phone开发环境搭建
- Ubuntu下面搭建Android应用开发环境
- Windows Phone 7 开发环境的搭建
- 联想乐phone Android 开发环境搭建
- 简单搭建Windows Phone 7 开发环境
- Windows phone 7开发环境搭建
- windows phone开发环境的搭建
- WP_Windows Phone 7 开发环境搭建
- 搭建Windows phone 7 开发环境
- Windows Phone 7 开发环境的搭建
- Windows Phone 8 开发环境的搭建
- [Android游戏开发经验分享]关于Sockets与服务端建立长连接交互
- 找工作与参加工作哪些事!
- iOS .a文件如何上传svn
- DB job相关
- 光阴流转 情怀不变
- Ubuntu Phone应用开发环境搭建
- Ruby on rails Web开发单元测试部分断言
- HLG 1360 Leyni的国家III (并查集)
- C语言中的typeof
- RAC Ocfs2文件系统常见问题解决方法
- Android的集成新浪微博第三方登录
- 关于ios7上无法计算UITextView的contentSize.height的解决方法
- 表单的相关事件及特效
- google-gson使用解析