1、下载在线安装器
下载URL:
https://download.qt.io/official_releases/online_installers/qt-unified-linux-x86_64-4.1.0-online.run
2、安装c++/gdb/java
sudo apt update
sudo apt upgrade
sudo apt -y install build-essential libgl1-mesa-dev gdb default-jdk
3、安装libxcb-util1
下载URL:
https://packages.debian.org/bullseye/amd64/libxcb-util1/download
下载文件:
libxcb-util1_0.4.0-1+b1_amd64.deb
安装命令:
sudo dpkg-deb -xv libxcb-util1_0.4.0-1+b1_amd64.deb /
实际安装目录为:
/usr/lib/x86_64-linux-gnu/
4、安装Android SDK
(1)在应用商店安装Android Studio。
(2)启动Android Studio,在Configure/SDK Manager下安装sdk/ndk/arm8/
SDK Platforms
Android API 31
Android SDK Platform 31
Google APIs arm 64 v8a System Image
Google APIs Intel x86 Atom_64 System Image
Android11.0(R)
Android SDK Platform 30
Android7.0(Nougat)
ARM 64 v8a System Image
SDK Tools
Android SDK Build-Tools 31
30.0.2
NDK(Side by sidy)
21.3.6528147
Android SDK Command-line Tools(latest)
Android SDK Command-line Tools(latest) 5.0
Android Emulator 30.8.4
Android SDK Platform-Tools 31.0.3
5、安装qt
./qt-unified-linux-x86_64-4.1.0-online.run
安装路径:
~/Qt
安装选项:
Qt
Qt 6.2.0
Desktop gcc 64-bit
WebAssembly(TP)
Android
Sources
Qt Quick 3D
Qt Wayland Compositor
Qt5 Compatibility Module
Qt Shader Tools
Additional Libraries
All…
Qt Debug Information
Qt Quick Timeline
Developer and Designer Tools
QtCreator 5.0.2
Qt Installer Framework 4.1
CMake 3.21.1
Conan 1.33
Ninja 1.10.2
6、配置cmake
sudo ln -s ~/Qt/Tools/CMake/bin/cmake /usr/bin/cmake
7、修补输入法
sudo cp /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so ~/Qt/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/
8、下载android_openssl
https://github.com/KDAB/android_openssl/tree/openssl_1_1_1k
下载zip包文件:
android_openssl-master.zip
解压到~/Android/Sdk/目录下
9、配置Qt默认版本为Qt6
检查Qt版本选项:
qtchooser –l
增加Qt6版本选项:
qtchooser -install qt6 /home/xman/Qt/6.*/gcc_64/bin/qmake
配置/etc/profile,在末尾增加:
export QT_SELECT=qt6
export QTDIR=/home/<username>/Qt/
#注:<username>替换为实际用户
export PATH=$QTDIR/6.2.0/gcc_64/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/6.2.0/gcc_64/lib:$LD_LIBRARY_PATH
10、在Qt中配置Android开发环境
打开菜单工具/选项,在设备/Android配置页中
(1)配置Java
JDK路径:
/usr/lib/jvm/java-11-openjdk-amd64/
(2)配置Android SDK
Android SDK路径:
~/Android/Sdk
Android NDK清单:
~/Android/Sdk/ndk/21.3.6528147
(3)配置Android OpenSSL
OpenSSL库路径:
~/Android/Sdk/android_openssl
(4)配置环境变量
编辑/etc/profile,增加以下行。
export ANDROID_HOME=/home/xman/Android/Sdk
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH