Android applications are Java applications running on a virtual machine called "Dalvik". This causes many problems for a Qt / C ++ application to run on such a Java-based platform. To do this, the Qt Android app has two parts. The first part is your own Qt / C ++ application, which is hosted by qmake. The second part is the launcher, which is the Java code created by Qt Creator, automatically based on your settings, settings and the target version of Android.
Launcher is a Java process, so Qt apps for Android have a Java-based entry point. The Java code in Launcher will load the necessary Qt libraries based on the meta-information specified in other files in the template. Therefore, when the Qt application for Android is launched, it is just a normal Java application. The entry point will be in QtActivity.java , which can be found in android/src/… in the project build directory.
After loading the Qt libraries, the Java code will run the main () function of the application in a new thread, and the application will start. At this point, Java code is used to delegate events from Android to Qt. Qt for Android applications uses the Java Native Interface (JNI) to communicate between the Java world and the C ++ world.
source share