Table of contents
1. Qt Android environment construction
2.1. Deploy to emulator (Android virtual machine)
2.1.3. Display on the simulator
3. Articles referenced during the process
3.1. Emulator hardware acceleration
1. Qt Android environment construction
Platform: Qt5.15.2
Official website tutorial:
Getting Started with Qt for Android | Qt 5.15
Online tutorials:
qt5.15.2 configuration android_Come on, Xiaodu’s blog-CSDN blog
Note: Please note that there cannot be spaces in the path of ndk . I previously installed it in the location under "C:\Program Files (x86)" by default. This seems to be automatically installed by Qt Creator based on the location of the Android SDK, because it is installed , maybe there is no internal check path, so it is written directly. Then, when I compiled with qmake, I got an error:
:-1: error: Project ERROR: Cannot run target compiler 'C:\Program Files (x86)\Android\android-sdk\ndk\25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++'. Output:
===================
===================
Maybe you forgot to setup the environment?
2. Deployment
2.1. Deploy to emulator (Android virtual machine)
2.1.1 Add emulator
To add an emulator, you can use Qt or AVD Manager.exe that comes with the Android SDK. What you need to pay attention to is whether the architecture (ABI) matches the ABI selected when building, and whether the target API is the same.
Qt adds simulator icon
Set the ABI and build platform SDK in [Project-Build] (there is no corresponding SDK, you can download it in SDK Manager.exe)
AVD Manager adds an emulator icon:
After adding through the above method, you can view it on the device
2.1.2 Deploy to device
First select the device to be deployed to: click the mobile phone icon in the lower left corner and select the device to be deployed (as shown below); right-click the project and select Deploy. When the deployment progress bar runs out, it means it has been deployed to the device and you can view it.
2.1.3. Display on the simulator
2.2. Deploy to real machine
Wireless connected devices
In the same LAN, devices can be connected wirelessly. Before that, you need to turn on the developer mode of the phone and the wireless debugging switch, where you can view the IP and port number, and some need to be paired, as shown below
Use the adb command to connect to the device, as follows:
1. Locate the command line under platform-tools under Android SDK, and you can see the tool adb.exe,
2. Pair (ip and port are the address and port number corresponding to the Android device)
adb pair ip:port
3. Make a connection
adb connect ip:port
3. The actual operation diagram is as follows
3. Articles referenced during the process
3.1. Emulator hardware acceleration
I used acceleration when testing with the simulator, and the speed is really fast. After downloading it in the sdk, I still need to find the location to install it.
Possible reference location E:\ProgramFiles\Android\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager
3.2. Version selection
At the beginning, you may not be sure how to choose ABI and CPU. Please refer to the following article.
Introduction to ABI
Android ABI_android_abi_Qingfeng Xu Lailiao's blog-CSDN blog