When using Qt to develop apps for Android, sometimes our app will carry some resource files, such as png, jpg, etc., or there may be some configuration files, such as xml, etc. Where are these files placed?
There are two ways:
Let's take a look at each.
Qrc, Qt's resource file system, very easy to use. Look at a picture:

Figure 1 qrc schematic
Files you put in qrc, such as copy.png , will be compiled into the exe file (Android application is libapplication.so ). These resources are also loaded into memory when you run the app. If your resources are large, this is a problem.
If it's on the Android platform, you have another option.
There is an assets directory in the Android project directory. The files placed in this directory will be packaged into the APK. The APK will not be installed into the application directory when the Android system is installed. Note that it is still in the APK. But the app can access the resources in this folder!
Qt uses this mechanism to implement the assets virtual file system. Our common QFile, QPixmap, QImage, etc. can access the files in assets through "assets:/".
With the assets virtual file system, your resource files are not loaded into memory at program startup, saving resources.
Look at a picture:

Figure 2 Asset diagram
How to put the resource file? Very simple, just put it in the android/assets folder in the Qt project directory. Figure 3:

Figure 3 Directory structure using assets
As long as you put it in, Qt compiles the files in assets into APKs and then accesses them in C++ code.
ReferenceQt on Android: Graphical explanation of the whole process of Hello World》Build a project for Android.
Create AndroidManifest.xml and place a beauty.jpg in the android/assets directory. Delete the widget.h and widget.cpp of the project. Modify main.cpp as follows:
#include <QApplication>#include <QLabel>#include <QPixmap>int main(int argc, char *argv[]){ QApplication a(argc, argv); QLabel label; QPixmap pixmap("assets:/beauty.jpg"); label.setPixmap(pixmap); label.show(); return a.exec();}

Figure 4 Qt on Android example using assets
OK, this is the end.
Review the Qt on Android series:
Qt on Android: Graphical explanation of the whole process of Hello World Getting started with Qt 5.2 for Android development under Windows Qt for Android deployment process analysis Qt on Android: Output Qt debugging information to logcat Qt on Android: Qt 5.3.0 release, improved instructions for Android Qt on Android Episode 1 (translation) Qt on Android Episode 2 (translation) Qt on Android Episode 3 (translation) Qt on Android Episode 4 (translation) Qt for Android compiles pure C project Qt for Android compiles Android C language executable program under Windows Qt on Android: Android SDK installation Qt on Android: http download and Json analysis Qt on Android settings app is called Chinese Qt on Android: Let Qt Widgets and Qt Quick apps display full screen Qt on Android: How to adapt to different screen sizesThen share the artificial intelligence tutorial of my teacher, God. Zero-based! Easy to understand! Humorous! Also with a yellow paragraph! I hope that you will also join our team of artificial intelligence!this link
1. Code 2. Effect As shown in the figure, get the file list in this QRC Partial print output...
Upper code Finished...
In Android resource files can be placed in assets directory (subdirectories can have) Packing and program together for the jar, the jar package can be referenced only in the other project reference, d...
res / raw points and assets of the same: 1. Both file folder after packaging will be stored in intact apk package. It will not be compiled into a binary. res / raw assets and differences: 1.res...
[PYQT] use .QRC generation resource file for use Establish an images.qrc file, save the resource location: 1 2 3 4 5 6 7 8 9 By command, use this qrc file to generate images.py resource files: 1 Use i...
Qt Under the error: Dependent 'resource file name .QRC' Does not exist. The reason is not found to find the original file Place the resource file in the folder where the source code is located, then.p...
Premise: Since my work colleagues are joint projects developed in vs2010+qt and under vs, I also have to follow this line of thinking. Most of the online routines are developed under QT Creater. Most ...
QT how to use resource files .qrc Here the record about the time the summary txt file: Step (I use): After this mainly to solve the replacement of the computer, run the .exe file, the picture does not...
In order to avoid different paths on the picture files on different computers, QT introduces the concept of resource files, but when OpenCV reads pictures, the resource file path cannot be recognized....
(turn) Underlying assets directory files are packaged into a apk file, these resources are decompressed when they did not install, use is read directly from the apk. Here in the introduction to how to...