一、准备软件:
1.Qt 5.5.1 for Android (Windows 32-bit, 935 MB) (info) :
http://www.qt.io/cn/download-open-source/
http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-windows-x86-android-5.5.1.exe
2.ndk:android-ndk-r10e-windows-x86.exe
http://developer.android.com/ndk/downloads/index.html
Windows 32-bit android-ndk-r10e-windows-x86.exe
Windows 64-bit android-ndk-r10e-windows-x86_64.exe
Mac 64-bit android-ndk-r10e-darwin-x86_64.bin
Linux 32-bit(x86) android-ndk-r10e-linux-x86_64.bin
Linux 64-bit(x86) android-ndk-r10e-linux-x86_64.exe
3.sdk: android-studio-bundle-141.2456560-windows.exe
http://developer.android.com/sdk/index.html
https://dl.google.com/dl/android/studio/install/1.5.1.0/android-studio-bundle-141.2456560-windows.exe
5.jdk:jdk-8u72-windows-i586.exe
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://download.oracle.com/otn-pub/java/jdk/8u72-b15/jdk-8u72-windows-i586.exe
6.ant:apache-ant-1.9.6-bin.zip
http://ant.apache.org/bindownload.cgi
http://apache.opencas.org//ant/binaries/apache-ant-1.9.6-bin.zip
二、安装软件
1,把jdk-8u72-windows-i586.exe 安装到C:\Qt\Java\jdk1.8.0_72\ 和C:\Qt\Java\jre1.8.0_72;
2,把android-studio-bundle-141.2456560-windows.exe 安装到C:\Qt\Android\Android Studio 和 C:\Qt\Android\sdk;
3,把android-ndk-r10e-windows-x86.exe 运行自己解压后复制到C:\Qt\android-ndk-r10e;
4,把apache-ant-1.9.6-bin.zip 解压到C:\Qt\apache-ant-1.9.6-bin\apache-ant-1.9.6\bin\ant.bat;
5,把qt-opensource-windows-x86-android-5.5.1.exe 安装到C:\Qt\Qt5.5.1;
三、开发软件
1,配置环境
打开C:\Qt\Qt5.5.1\Tools\QtCreator\bin 下面的 qtcreator.exe,在 “工具”->“选项”里面选择“andorid”的配置填入上面的软件JDK、SDK、NDK、ANT的安装或者存储路径。
2,建立工程
A,打开 qtcreator.exe,在“文件”->“新建文件或项目”选择“所有模板”->Application->Qt Widgets Application ,然后点击“Choose…”,选择项目路径“D:\works\TEST\qttest”和项目名称“test”,勾选“Android for armeabi-v7a(GCC 4.9 ,Qt 5.5.1)”和“Desktop Qt 5.5.1 MinGW 32bit”两个模板;
B,一路直接按下去就建立好测试项目,选择“Android for armeabi-v7a(GCC 4.9 ,Qt 5.5.1)”工程配置下的“release”进行编译,就会在“D:\works\TEST\qttest\build-test-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release\android-build\bin”下生成“QtApp-debug.apk”和“QtApp-debug-unaligned.apk”文件;
C,把生成的APK文件通过数据线下载到安卓手机就能安装测试使用。