Qt Quick build Android app

Foreword

  He is engaged in the development of Qt PC, recently, due to the company's project is almost done, restless Oh, sneak a look at the example it official, currently find themselves doing real interface low burst, instant hit with wood have affected the speed of light! ? Who he is still entering the community, beatings small rookie of it, resigned slightly. But still can not help but give it a try, perhaps he still has a little bit of lifting it. And then try to use qt quick Qt build Android app, stepped pit plenty of money, but finally succeeded. I feel happy, feel grateful, hum hum ~

 

text

  First of all, here the configuration software, then, to note that version, unlike Android Studio , just updated to the latest version of its built environment configuration will automatically help us configure, even if some small problem, you can also find solutions through scientific online. But Qt itself is not specifically for the development of Android app generated, therefore, its configuration is relatively simple, but the configuration version of the problem that some packages were not Android Stutio strong (after all, they are professional, manual funny), I was QT environment when you configure Android NDK, is a manifestation of this problem, download the latest version from the official website android-ndk-r21-windows-x86_64.zip configuration Qt5.12.2 time, it will appear somehow can not find -lc ++, using the old version this problem will not occur when the NDK, maybe not the official solution to this problem, either domestic or not there are few resources in this area.

 

First, the software version and test environment

  Operating System: Windows 10 - 64-bit operating system

  ˇ Qt creater:Qt5.12.2

 

Two, Android Development Kit

 

  We follow their own computer configuration choose to install packages on ok, my personal choice is the 64-bit version to download.

  ˇ JDKjdk-8u241-windows-x64.exe

Here we directly select to download the latest version

 

   ˇ Android sdkandroid-sdk_r24.4.1-windows.zip

 

   Android NDK : android-ndk-r19c-windows-x86_64.zip

Interested Tell me what you can choose to try other versions of NDK Kazakhstan, it is not so much traffic slightly.

 

JDK is the Java language Software Development Kit, is the core of java development, it contains JAVA runtime environment (JVM + Java system class library) and JAVA tools. Here only to find out.

Android SDK refers to the exclusive Android Software Development Kit.

Android NDK is a set of tools to achieve the various parts of the C and C ++ language to native code applications. For certain types of applications that can help us to reuse code libraries written in these languages.

 

Third, the environment variable configuration and Downloads

  Jdk  configuration:

Variable name: JAVA_HOME
Variable value: F: \ jdk \ java (placing himself absolute path)

Variable name: CLASSPATH
Variable values:;. % JAVA_HOME% \ lib;% JAVA_HOME% \ lib \ tool.jar

path:
%JAVA_HOME%\bin
%CLASSPATH%

 

  ˇ Android SDK

After our good sdk download archive, unpacked, as shown below

 

 Simply double-click to run the SDK Manger.exe, in fact, here only need to select a few to get a check on the OK , no need to change the domestic image, under normal circumstances can be downloaded, not back to the mirror also the ok , check the download in the following order .

1、

 

 

 2、

 

 3、

 

 4、

 

 The above configuration needs to be based on individual configuration. For domestic mirroring, degree of your mother on their own, and finally click install. Once downloaded its directory structure is as follows:

 

 After configure environment variables

A  variable name: ANDROID_HOME
 2 variable values: E: \ the Android \ Sdk \ Android-SDK- Windows
 . 3  
. 4  path:
 . 5 % ANDROID_HOME% \ platform- Tools
 . 6 % ANDROID_HOME% \ Tools

  Android NDK :

Ndk package to extract the direct compression, the directory structure as follows:

 Here's Android system files related configuration is complete, then configure Qt5.12.2 development environment.

 

Four, Qt Quick engineered

 

1、

  Here brief mention installed components Qt, Android can select all the components, check the relevant MinGW version.

 

Android x86 

Android ARM64-v8a

 

Android ARMv7

Other necessary check.

 

 Wait for the installation to complete ...... After the installation is complete, we need to make some configuration options.

 

Before the configuration file path will be a good addition. Setting OK on the configuration is successful.

 

 

 Finally, as shown above is displayed, it means success, from our target is getting closer, more and more physically and mentally exhausted. Click OK.

 

 

2, engineered

  Next, for example of a Hello Qt.

2.1

 

It is normal to make selections in ok

 

 Click Finish. Then write main.qml code,

 1 import QtQuick 2.9
 2 import QtQuick.Window 2.2
 3 
 4 Window {
 5     visible: true
 6     width: 640
 7     height: 480
 8     title: qsTr("Hello World")
 9 
10     Text {
11         id: content
12         text: qsTr("Hello Qt")
13         anchors.centerIn: parent
14     }
15 
16     MouseArea {
17         anchors.fill: parent
18         onClicked: {
19             Qt.quit();
20         }
21     }
22 }

After completion, the project is configured.

 

 In step build configuration, as shown below:

 

In the second step which Keystore creation, is to create an application for the App signature, different App have different Keystore , in accordance with

Tips to create the ok , which to remember your set password and full name of the package, a simple set of points on the ok , as shown below:

 

 

 Creating AndroidManifest.xml file

 

Click on the Create Templates , create the file, as shown below:

 Follow the prompts to configure.

 

In the arrow Add drop-down box to select Fig Android App permission to run, save it.

In the XML Source can interface layout file.

Application name that is the name of the application, other functions of the interface may Mother. Finally, build the project running, the phone line by connecting data

 

进行安装应用,传输模式选择文件传输,开启开发者选项即可。

 

 

码字真的要老命 zzzzzz

 

Guess you like

Origin www.cnblogs.com/shi-win-snoopy/p/12635104.html