2013-05-01 39 views

回答

10

下面介绍了在Ubuntu 12.04 LTS上编译Android版Qt5所需的步骤。为方便起见,我将假定以下所有命令都在目录/opt/qt5-android中运行。如果不是这种情况,则需要相应地调整路径。

  1. 首先,你需要确保相应的软件包安装:

    sudo apt-get install build-essential openjdk-6-jdk 
    
  2. 抓住最新的Android SDK:

    wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz 
    tar -xf android-sdk_r21.1-linux.tgz 
    
  3. 的SDK不与任何船舶平台,所以你需要抓住他们:

    android-sdk-linux/tools/android update sdk --no-ui 
    
  4. 抓斗最新版本的NDK的:

    32位(i686的):

    wget http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2 
    tar -xf android-ndk-r8e-linux-x86.tar.bz2 
    

    64位(AMD64):

    wget http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2 
    tar -xf android-ndk-r8e-linux-x86_64.tar.bz2 
    
  5. 现在克隆下面的Git仓库:

    git clone git://gitorious.org/qt/qt5.git qt5 
    cd qt5 
    perl init-repository --no-webkit 
    
  6. 我们快到了。现在,我们需要configuremake QT5:

    ./configure \ 
        -developer-build \ 
        -xplatform android-g++ \ 
        -nomake tests \ 
        -nomake examples \ 
        -android-ndk /opt/qt5-android/android-ndk-r8e \ 
        -android-sdk /opt/qt5-android/android-sdk-linux \ 
        -skip qttools \ 
        -skip qttranslations \ 
        -skip qtwebkit \ 
        -skip qtserialport \ 
        -skip qtwebkit-examples-and-demos 
    make 
    

就是这样!你现在应该结束Android的Qt5构建。


参考文献:

5

我并不想回应一个答案另一个答案,但是这是我的第一篇文章:-(我认为这可以防止我在发表评论时发表此文章。 (所以认为它是说回答,不是回复) Nathan上面的回答并不适合我。

我的配置行看起来更象这样:

./configure \ 
-developer-build -platform linux-g++-64 \ 
-xplatform android-g++ \ 
-nomake tests \ 
-nomake examples \ 
-android-ndk /opt/qt5-android/android-ndk-r8e \ 
-android-sdk /opt/qt5-android/android-sdk-linux \ 
-skip qttools \ 
-skip qttranslations \ 
-skip qtwebkit \ 
-skip qtserialport \ 
-android-ndk-host linux-x86_64 

这里的原因:

  • -skip qtwebkit-examples-and-demos导致配置错误......它不喜欢,我是跳过一些couldn (不好意思,我输了确切的错误信息)

  • -android-ndk-host linux-x86_64停止配置从“”中止0“

  • -platform linux-g++-64是我是偏执是否配置将增加-m64标志或任何工作它的魔力,我

除了这个差别时,内森的过程似乎像一个魅力的工作。我现在的本地环境建设(感谢提示,奥斯曼先生:-)