window 下Qt for android 環境搭建

來源:互聯網
上載者:User

標籤:android   blog   http   java   io   for   ar   檔案   art   

*******************************************************************

  轉自http://www.cnblogs.com/rophie/p/3226543.html?ADUIN=2625726808&ADSESSION=1408536978&ADTAG=CLIENT.QQ.5329_.0&ADPUBNO=26349

 

1.下載安裝Qt 5.1.0 for Android (Windows 32-bit, 716 MB)   http://qt-project.org/downloads

2.開啟Qt Creator,開啟協助,輸入android,找到官方說明,按照教程一步步的操作。

3.首先需要下載以下四個軟體:

  1)The Android SDK Tools  下載安裝

  2)The Android NDK  下載並解壓,注意不能有空格

    3)Apache Ant v1.8 or later  下載並解壓,同上

  4)OpenJDK v6 or later   下載並解壓

4.開啟Qt Creator,選擇工具-選項-android,配置好剛剛安裝的檔案路徑,並點擊【啟動android AVD管理器】

5.點擊  New  建立一個android模擬器,根據自己需要選擇Device

6.點擊ok-ok,並選擇剛剛建立的裝置,點擊Start啟動,此過程比較慢,耐心等待。

7.重啟Qt Creator 已經可以看到有裝置了,我們檢查 構建和運行 中 構建套件和Qt版本是否正確,確認無誤接下來就可以建立工程

8.建立一個Qt gui項目,選擇android for arm

9.修改代碼,顯示hello Qt

#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include <QLabel>class MainWindow : public QMainWindow{    Q_OBJECT    private:    QLabel *label;public:    MainWindow(QWidget *parent = 0);    ~MainWindow();};#endif // MAINWINDOW_H
#include "mainwindow.h"MainWindow::MainWindow(QWidget *parent)    : QMainWindow(parent){    label=new QLabel("hello Qt",this);    label->setGeometry(10,10,100,30);}MainWindow::~MainWindow(){    }


 

10.直接點擊  構建 查看能不能正常編譯,如果此間報錯,可以留言,儘力為大家解決。一切正常的話直接點擊運行,此過程較慢,會編譯成apk檔案並且部署到模擬器上。

不知道這裡為什麼不是全屏,還沒有仔細研究。呵呵

可在項目屬性中修改android程式的一些設定

具體設定可以在Qt協助中查看,穩定版本要等到Qt5.2發布,相信Qt會做的越來越好。

環境搭建到此結束!

window 下Qt for android 環境搭建

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.