Xun developed Qt for Android for i.MX6ULL Terminator QT application
[Copy link]
QT is an excellent cross-platform tool. So we only need to master the method of QT to make the interface, and we can easily make QT cross-platform applications.
Why learn QT_For_Android?
1. Experience the superiority of QT cross-platform
2. It is very suitable for us non-professional developers to develop and debug APP.
1 Build the development environment
1. Install JDK, select the default path, and click Next all the way.
After the installation is complete, enter the corresponding path to view:
Issues to note:
(1) It is recommended to use the version we provide. If you download it yourself, there may be problems.
(2) It is recommended that you install it to the C drive without any Chinese path.
2. To install SDK and NDK, just unzip them. The unzipped path should not have any Chinese path. I unzipped it to the JDK installation path. If the C drive does not have enough space, you can unzip it to another drive, but remember the location, as it will be needed below.
3.Configure the environment
Open QTCreator, open Tools->Options, and select the content as shown in Figure 1.4:
Set the path of JDK, SDK and NDK, as shown in Figure 1.5:
After the settings are completed, we click Apply and OK.
2. Create an Android app
To activate the compiler, click Project -> Android Compiler, and then you can see the Android compiler in the lower left corner. .
Switch the compiler to Android compiler, as shown in Figure 2.2, then connect the phone and the development board to OTG.
After connecting the phone or development board (development board to burn Android system), check whether there is any problem with the compilation tool and whether it reports an error. If not, you can proceed to the next step.
Click run to see if our phone or development board is found, and whether Android Device appears in the device manager. If not, you need to check whether the adb driver is normal. Use Driver Genius to check whether the driver is normal, and whether the USB debugging of the phone or development board is turned on. The USB debugging of the phone is in the developer mode.
After the development board or mobile phone is recognized, click run to start compiling. Note that the computer must be connected to the Internet at this time. It will not work without an Internet connection.
Possible errors:
what went wrong:
Cause of the problem: blocked.
Solution: Change the source.
Enter the compiler setting options: as shown in Figure 2.4:
Click Project, click Details for Build Android APK, click Create Template, and then click Finish.
Then we will get a lot of files under our project. We click the build.grade file and comment out jcenter, as shown in Figure 2.5:
Then add the following code to the build.grade file,
comment out the two jcenters, and add new sources (Alibaba Cloud) below:
maven { url 'https://maven.aliyun.com/repository/jcenter'}
As shown in Figure 2.6:
After the compilation is completed, the APP will be automatically installed on the development board or mobile phone.
Set the APP icon: Open the project file .pro, at the bottom is the project folder, put the icon into this folder.
The icon format must be PNG format.
Then select AndroidManifest.xml in the generated file, fill in the APP name, the Run edit bar should be consistent with the project name, and the three icons below Application icon should also be filled in. As shown in Figure 2.9:
The path of the generated APK is in the project directory
build-time-Android_for_armeabi_v7a_GCC_4.9_Qt_5_11_1_for_Android_armv7-Debug\android-build\build\outputs\apk
After success, it will be as shown in Figure 2.11:
|