CN112000364B - Application program packaging method, device, equipment and storage medium - Google Patents

Application program packaging method, device, equipment and storage medium Download PDF

Info

Publication number
CN112000364B
CN112000364B CN202010842561.1A CN202010842561A CN112000364B CN 112000364 B CN112000364 B CN 112000364B CN 202010842561 A CN202010842561 A CN 202010842561A CN 112000364 B CN112000364 B CN 112000364B
Authority
CN
China
Prior art keywords
resource
application program
picture
picture resource
sets
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010842561.1A
Other languages
Chinese (zh)
Other versions
CN112000364A (en
Inventor
张力
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Baiguoyuan Information Technology Co Ltd
Original Assignee
Guangzhou Baiguoyuan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Baiguoyuan Information Technology Co Ltd filed Critical Guangzhou Baiguoyuan Information Technology Co Ltd
Priority to CN202010842561.1A priority Critical patent/CN112000364B/en
Publication of CN112000364A publication Critical patent/CN112000364A/en
Application granted granted Critical
Publication of CN112000364B publication Critical patent/CN112000364B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a packaging method, a packaging device, packaging equipment and a storage medium of an application program, and belongs to the technical field of computers and Internet. The method comprises the following steps: in the project construction process of the application program, acquiring a picture resource set used by the application program, wherein the picture resource set comprises picture resources in a third-party dependency library; generating a plurality of sets of picture resource sets with different versions based on the acquired picture resource sets; wherein the different versions correspond to different resolution levels; packaging the files of the application program to generate a file package of the application program; the file of the application program comprises a plurality of sets of picture resource sets with different versions. According to the embodiment of the application, in the project construction process of the application program, based on the picture resource sets corresponding to the application program, a plurality of sets of picture resource sets with different versions (namely different resolution levels) are generated, so that the automatic generation of the plurality of sets of picture resource sets with different versions is realized, and the configuration efficiency of the picture resource sets is further improved.

Description

Application program packaging method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical fields of computers and the Internet, in particular to a packaging method, a packaging device, packaging equipment and a storage medium of an application program.
Background
Currently, electronic devices on the market have different resolutions, and in order to adapt to electronic devices with various resolutions, a developer proposes a method for configuring multiple resolution levels for the same resource.
In the related art, taking configuration of picture resources as an example, in the process of configuring picture resources by a developer, picture resources of different resolution levels need to be manually configured. The resolution level of the picture resource may include Ldpi (Low Dpi, low resolution), mdpi (Medium Dpi, medium resolution), hdpi (High Dpi, high resolution), and the like, which the developer needs to manually configure into the corresponding picture resource file.
However, the above process of manually configuring picture resources is complicated in operation and inefficient.
Disclosure of Invention
The embodiment of the application provides a packaging method, a packaging device, packaging equipment and a storage medium of an application program, which can automatically configure picture resource sets of different versions (namely different resolution levels) and improve the efficiency of configuring the picture resource sets. The technical scheme is as follows:
according to an aspect of an embodiment of the present application, there is provided a packaging method of an application program, the method including:
in the project construction process of an application program, acquiring a picture resource set used by the application program, wherein the picture resource set comprises picture resources in a third-party dependency library;
generating a plurality of sets of picture resource sets with different versions based on the acquired picture resource sets; wherein the different versions correspond to different resolution levels;
Packaging the files of the application program to generate a file package of the application program; the file of the application program comprises a plurality of sets of picture resource sets with different versions.
According to an aspect of an embodiment of the present application, there is provided an apparatus for packaging an application program, the apparatus including:
the resource acquisition module is used for acquiring a picture resource set used by the application program in the project construction process of the application program, wherein the picture resource set comprises picture resources in a third-party dependency library;
The resource generation module is used for generating a plurality of sets of picture resource sets with different versions based on the acquired picture resource sets; wherein the different versions correspond to different resolution levels;
The file packaging module is used for packaging the files of the application program and generating a file package of the application program; the file of the application program comprises a plurality of sets of picture resource sets with different versions.
According to an aspect of an embodiment of the present application, there is provided a computer apparatus including a processor and a memory, in which a computer program is stored, the computer program being loaded and executed by the processor to implement the packaging method of the application program.
According to an aspect of an embodiment of the present application, there is provided a computer-readable storage medium having stored therein a computer program loaded and executed by a processor to implement the above-described packaging method of application programs.
According to an aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the packaging method of the application program.
The technical scheme provided by the embodiment of the application can bring the following beneficial effects:
In the project construction process of the application program, a plurality of sets of picture resource sets with different versions (namely different resolution levels) are generated based on the picture resource sets corresponding to the application program, so that the automatic generation of the plurality of sets of picture resource sets with different versions is realized without manual configuration, and the configuration efficiency of the picture resource sets is further improved.
In addition, the picture resource sets of different versions are packaged into the file package of the application program, so that the picture resource set generation process is automatically embedded into the application program file packaging process without manual monitoring management, and further the file packaging efficiency of the application program is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic illustration of an implementation environment for an embodiment of the present application;
FIG. 2 is a flow chart of a method for packaging an application provided by one embodiment of the present application;
FIG. 3 illustrates a schematic diagram of a picture of different resolution levels;
FIG. 4 is a flow chart of a method for packaging applications provided by another embodiment of the present application;
FIG. 5 illustrates a flow chart of an item construction process for an application;
FIG. 6 is a schematic diagram illustrating the relationship between resolution and magnification of a picture asset;
FIG. 7 is a flow chart of detecting whether a picture resource is processed according to one embodiment of the present application;
FIG. 8 is a block diagram of a packaging apparatus for an application provided in one embodiment of the present application;
fig. 9 is a block diagram of a packaging apparatus for an application program according to another embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Referring to fig. 1, a schematic diagram of an implementation environment of an embodiment of the present application is shown. The implementation environment of the scheme can be realized as an application program downloading system. The implementation environment of the scheme can comprise: a user terminal 11, an application download platform 12 and a developer terminal 13.
The user terminal 11 is a terminal device used by a user, and the user can access the application download platform 12 through the user terminal 11 and perform an application download operation on the application download platform 12. For example, a client of a target application program may be installed in the user terminal 11, and a user logs in the application download platform 12 through the client to perform an application download operation. The target Application may be any Application program that provides an Application download service, such as an APP (Application store), an APP (Application management Application) or other third party Application program with Application download capability, which is not limited by the embodiment of the present application. The user terminal 11 may be an electronic device such as a mobile phone, a tablet computer, a multimedia playing device, a PC (personal computer), a wearable device, a smart tv, etc.
The application download platform 12 is a network platform for providing application download services, and the content of an application download may include one or more installation packages associated with the application. The installation package may include configuration files, code files, resource files, and the like. In one example, the application download platform 12 is a network platform for providing video class application downloads, the installation packages of which include, but are not limited to, configuration files, code files, resource files, and the like. Alternatively, the application download platform 12 includes one or more servers 120, and the servers 120 may be background servers of the target application program described above for providing background services for the target application program.
The developer terminal 13 is a terminal device for providing a package of files for the application download platform 12. After the developer completes the development of the application program on the developer terminal 13, the developer packages and generates a package of the application program, and uploads the package to the application download platform 12. The package may include, among other things, configuration files, code files, and resource files for the application, such as a picture resource file that includes a plurality of different versions (i.e., resolution levels). The developer terminal 13 may be an electronic device such as a tablet computer, a PC (personal computer), a notebook computer, or the like.
Illustratively, in response to the application download requirement of the user terminal 11, the application download platform 12 extracts a corresponding file from the file package corresponding to the application uploaded by the developer terminal 13, generates an installation package of the application, and then transmits the installation package to the user terminal 11.
Alternatively, the application download platform 12 may generate an installation package of the corresponding attribute according to different attributes of the user terminal 11. For example, when the user terminals 11 with different resolutions download applications, the application download platform 12 can issue installation packages with corresponding resolution resources to the user terminals 11 with different resolutions. For example, if the resolution of one user terminal 11 is Hdpi, the application download platform 12 issues an installation package with a resolution of Hdpi resources. Therefore, the size of the installation package volume can be effectively controlled, and redundant resource overhead is reduced.
The user terminal 11 and the application download platform 12 may communicate with each other via a network, and the application download platform 12 and the developer terminal 13 may also communicate with each other via a network.
Referring to fig. 2, a flowchart of a method for packaging an application program according to an embodiment of the application is shown. The subject of execution of the steps of the method may be a computer device, such as the developer terminal 13 in the implementation environment shown in fig. 1. The method may comprise the following steps (201-203):
In step 201, in the project construction process of the application program, a picture resource set used by the application program is obtained, where the picture resource set includes picture resources in a third party dependency library.
In the embodiment of the application, the project construction process of the application program comprises the process of creating the project of the application program, adding files (such as configuration files, code files, resource files and the like) in the project, then compressing the files in the project according to classifications, and generating a file package. The files can also be obtained from a third-party dependency library, so that the file package can comprise original files in the project and files obtained from the third-party dependency library. The file may be a file such as a configuration file, a code file, a resource file, or the like. The resource files include picture resource files, text resource files, video resource files, and the like.
The picture resource set includes a plurality of picture resources used by the application program. In the case of taking a picture Format as a classification standard, one picture resource set may include at least one of picture resources in a BMP (Bitmap), JPEG (Joint Photographic Experts Group ), GIF (GRAPHICS INTERCHANGE Format, graphics interchange Format), or the like. Under the condition that the picture resolution level is taken as a classification standard, one picture resource set may include at least one of picture resources of the resolution level such as Ldpi (Low Dpi, low resolution), mdpi (Medium Dpi, medium resolution), hdpi (High Dpi, high resolution), and the like, and embodiments of the present application are not limited herein.
The third party dependency library refers to a dependency library other than the item dependency library of the application. The third-party dependency library may store resources required by the application, such as picture resources, and the required resources may be obtained from the third-party dependency library based on project construction requirements of the application. Alternatively, the third party dependency library may be one or more dependency libraries storing resources required to build the application program project. Alternatively, the resources in the third party dependency library may be resources in Aar (Android Archive) packages, jar (Java Archive) packages, or the like.
Step 202, generating a plurality of sets of picture resource sets with different versions based on the acquired picture resource sets; wherein different versions correspond to different resolution levels.
In the embodiment of the application, the obtained picture resource set includes original picture resources in the application program project and picture resources obtained from the third party dependency library. Alternatively, the set of picture resources may include picture resources of different resolution levels, such as Mdpi, hdpi, ldpi. For example, as shown in fig. 3, the resolution levels of the picture resource set include Xxxhdpi (192×192), xxhdpi (144×144), xhdpi (96×96), hdpi (72×72), and Mdpi (48×48).
Optionally, in the project construction process of the application program, a picture resource set used by the application program can be obtained through a designated plug-in, and a plurality of sets of picture resource sets with different versions are generated based on the picture resource set. The method comprises the steps that dependence on a designated plug-in is added in a designated project file of an application program, and the designated plug-in is used for acquiring a picture resource set used by the application program and generating a plurality of sets of picture resource sets with different versions. Taking android application as an example, dependency on Resizelmage plugins (namely the specified plugins) is added in a project file constructed by Gradle, and Resizelmage plugins are placed in Gradle. Properties files of a Module layer, when Gradle packages a Bundle, the dependency is automatically triggered, namely Resizelmage plugins are automatically called, a picture resource set used by an application program is obtained through Resizelmage plugins, and a plurality of sets of picture resource sets with different versions are generated based on the picture resource set. The whole process is automatically triggered without manual operation, so that the generation efficiency of the picture resource sets of different versions is improved.
The generating process of the picture resource sets of different versions may be compressing the resolution of the picture resources in the picture resource sets. For example, as shown in fig. 3, the picture resource set includes a picture resource with a resolution level of Xxhdpi (144×144), and invoking the specified plug-in to reduce the resolution level of the picture resource by 30%, a picture resource with a resolution level of Xxhdpi (144×144) may be obtained. Invoking the specified plug-in to reduce the resolution level of the picture resource set by 70%, and obtaining the picture resource with the resolution level of Mdpi (48 x 48).
Step 203, packaging the files of the application program to generate a file package of the application program; the file of the application program comprises a plurality of sets of picture resource sets with different versions.
In an embodiment of the present application, the files of the application include files in the application program project and files obtained from the third party dependency library. The files may include configuration files, code files, resource files, and the like. In addition, the application file further includes a plurality of sets of picture resource sets with different resolution levels generated in step 202.
By means of the packaging tool, the files of the application program can be packaged, and further a file package of the application program is generated, wherein the file package comprises the files of the corresponding application program.
In summary, according to the technical scheme provided by the embodiment of the application, in the project construction process of the application program, based on the picture resource sets corresponding to the application program, a plurality of sets of picture resource sets with different versions (i.e. different resolution levels) are generated, so that the automatic generation of a plurality of sets of picture resource sets with different versions is realized, manual configuration is not needed, and the configuration efficiency of the picture resource sets is further improved.
In addition, the picture resource sets of different versions are packaged into the file package of the application program, so that the picture resource set generation process is automatically embedded into the application program file packaging process without manual monitoring management, and further the file packaging efficiency of the application program is improved.
In addition, the process of automatically generating a plurality of sets of picture resource sets with different versions is in the project construction process of the application program, so that the picture resources can be obtained from a third-party dependency library and can be subjected to resolution compression operation, and the integrity of picture resource obtaining is improved.
Referring to fig. 4, a flowchart of a method for packaging an application program according to another embodiment of the application is shown. The subject of execution of the steps of the method may be a computer device, such as the developer terminal 13 in the implementation environment shown in fig. 1. The method may comprise the following steps (401-406):
in step 401, in the project construction process of the application program, the merge resource task is hooked through the Hook function.
In the embodiment of the application, the merge resource task is a task for merging resources used by an application program. The resources used by the application program refer to resources such as text, pictures and videos corresponding to the application program, and the resources used by the application program can comprise resources in application program projects, resources acquired from a third-party dependency library, picture resource sets of different versions generated by the following steps and the like.
The Hook function is used for hooking a target task in the project construction process of the application program and obtaining the control right of the task. At this time, modification processing such as target object, action, scope, etc. may be performed on the task, and a custom task may be added before the task. Taking android application as an example, in the Gradle project construction process, before the final Bundle is constructed, a merge resource task MergeResourceTsak is executed, and the task is used for compressing the resources in the project according to the classification, so as to generate a compressed file package base. However, prior to executing the merge resource task MergeResourceTsak, the merge resource task MergeResourceTsak is Hook-held by a Hook function and a custom task is inserted, which may include resolution compression of the picture resources and distribution of the resolution compressed picture resources to the various resolution folders.
Referring to FIG. 5, a flow chart of an item construction process for an application is illustrated. The project construction process of the application program mainly comprises an anchor point creating task, a resource merging task, a resource (Res) file processing task, a construction packaging task and the like. In the embodiment of the application, in the project construction of an application program, the merging resource task 51 is hooked by a Hook function, and the merging resource task 51 is suspended to execute a new custom task so as to generate picture resource sets with different resolution levels, and after the picture resource sets with different resolution levels are generated, the execution is continued from the merging resource task 51.
Step 402, calling a resource obtaining function through a custom task, wherein the resource obtaining function is used for obtaining a resource catalog of an application program, and the resource catalog comprises a picture resource catalog.
Optionally, before executing the merge resource task, a custom task is executed, the custom task including invoking a resource acquisition function. The resource acquisition function is used for acquiring a resource catalog of the application program, and the resource catalog comprises a picture resource catalog. Taking the android application as an example, before the Hook merges the resource tasks MergeResourceTask, the resource directory of the application program is obtained by calling GetRawAndriodResources () function (i.e., the above-mentioned resource acquisition function).
The resource directory of the application refers to a directory of resource files of the application. The file name and file address of each resource file, or other file information, may be recorded in the resource directory, and embodiments of the present application are not limited herein. The picture resource directory refers to a folder for storing picture resources. Alternatively, the file name and file address of each picture resource may be included in the picture resource directory.
Step 403, based on the picture resource catalog, obtaining a picture resource set used by the application program.
Alternatively, the picture resource set used by the application program may be acquired according to the file name and the file address of the picture resource recorded in the picture resource directory.
Step 404, generating a target picture resource of a low resolution level of the first resolution level based on the target picture resource of the first resolution level in the picture resource set.
The target picture resource may be any picture resource in the picture resource set, and the first resolution level is a resolution level of the target picture resource. And based on the target picture resource, performing copying operation, performing resolution level compression operation on the copied target picture resource, generating a new target picture resource, namely a picture resource with low resolution level, and then storing the new target picture resource.
The new target picture resource has the same content as the original target picture resource, and the resolution level of the new target picture resource is lower than that of the original target picture resource. Alternatively, the process may generate a plurality of different low resolution levels of target picture resources below the first resolution level, depending on the requirements of the application. For example, referring to fig. 3, the resolution level of the target picture resource is Xxhdpi (144×144), and based on the target picture resource, it may also generate picture resources with different low resolution levels, such as Xhdpi (96×96), hdpi (72×72), mdpi (48×48), and the like.
Optionally, the picture resources of different resolution levels occupy different volumes in the file package mentioned below. For example, the occupancy volume of picture resources at Xhdpi resolution level is higher than the occupancy volume of picture resources at Hdpi resolution level. Referring to fig. 6, when the resolution at the Xxhdpi resolution level is 1080×1920, the magnification is 12, when the resolution at the Hdpi resolution level is 480×480, the magnification of the picture resource at the xxhdpi resolution level is 6, which is 2 times the magnification of the picture resource at the Hdpi resolution level, that is, the picture resource at the Xxhdpi resolution level occupies 1 time more volume than the picture resource at the Hdpi resolution level. The magnification of the picture resource is positively correlated with the occupied volume of the picture resource, for example, if the magnification of the a picture resource is 2 times that of the B picture resource, the occupied volume of the a picture resource is 2 times that of the B picture resource.
Alternatively, picture resources of different resolution levels may be stored in resource folders of corresponding resolution levels. A resolution level resource folder stores a resolution level picture resource. The name of the resource folder may be the resolution level of the deposited picture resource. Optionally, a corresponding number of resource folders is generated based on the number of categories of the picture resource resolution level.
In one example, the target picture resource concrete content that generates the low resolution level of the first resolution level may be: sequentially traversing resource folders corresponding to resolution levels lower than the first resolution level according to the order of the resolution levels from high to low, and detecting whether the resource folders contain target picture resources with the corresponding resolution levels; if the resource folder does not contain the target picture resources with the corresponding resolution level, generating the target picture resources with the corresponding resolution level; if the resource folder contains the target picture resource with the corresponding resolution level, the next resource folder can be directly detected without generating the target picture resource with the corresponding resolution level. For example, referring to fig. 3, the resolution level of the target picture resource is Xxhdpi (144×144), when it is detected that the resolution level resource folder of Xhdpi (96×96) does not include the picture resource of Xhdpi (96×96) resolution level according to the detection of the resolution level from high to low, the picture resource of Xhdpi (96×96) resolution level is copied and stored in the resolution level resource folder of Xhdpi (96×96). When it is detected that the Hdpi (72×72) resolution level resource folder contains the Hdpi (72×72) resolution level picture resource, the Hdpi (72×72) resolution level picture resource is not required to be copied and generated, and the next resource folder can be directly detected.
Optionally, in the embodiment of the present application, in order to avoid distortion of the interface display, an operation of copying the picture resource to the high resolution level is not performed.
Alternatively, whether the resource folder contains the target picture resource with the corresponding resolution may be determined by detecting whether the target picture resource with the corresponding file name exists in the resource folder. For example, if the file name of the target picture resource is a, and the target picture resource of the resolution level corresponding to the file name a exists in the resource folder of the secondary resolution level, it may be determined that the target picture resource of the resolution level already exists, and then the operation of generating the target picture resource of the resolution level is not required. If the target picture resource of the resolution level corresponding to the file name A does not exist in the resource folder of the secondary resolution level, the operation of generating the target picture resource of the resolution level is performed, and the file name is named A. Thus, picture resources with the same file name but different formats can be prevented from being displayed in one resource folder.
Optionally, according to the above-mentioned specified plug-in, the picture resource set used by the application program can be obtained, and the copying and the resolution level compression operation can be performed, so as to generate multiple sets of picture resource sets with different versions. For example, taking android application as an example, in the process of generating a plurality of sets of picture resource sets with different versions, a Python script is called to perform resolution level compression on picture resources, and the picture resources are copied to a resource folder summary of a corresponding resolution level. Optionally, the compression tool may also employ local compression or Webp (Weppy, a picture file format) formatting. It should be noted that, picture resources with different formats may be generated according to different compression tools, but in one resource folder, picture resources with different file names and different formats are not allowed to be generated, so that type interference may be prevented. Taking android application as an example, if one resource folder includes an a.png resource picture, the a.webp resource picture cannot be regenerated in the resource folder.
And step 405, respectively placing the target picture resources of each resolution level into the resource folders of the corresponding resolution level.
Optionally, the picture resources may be sequentially stored in the resource folders corresponding to the resolution levels according to the resolution levels, and if the storage of the target picture resources of each resolution level is completed, the file name of the target picture resource is stored in the cache, that is, the target picture resource is processed. Alternatively, whether the target picture resource has been processed may be confirmed by detecting whether there is a file name of the target picture resource in the buffer memory.
In one example, after obtaining a target picture resource from a picture resource set, detecting whether a file name of the target picture resource exists in a cache; the file name of the processed picture resource is stored in the cache; if the file name of the target picture resource does not exist in the cache, executing the step of generating the target picture resource with the low resolution level of the first resolution level; and if the file name of the target picture resource exists in the cache, acquiring the next picture resource from the picture resource set.
Wherein the step of executing the target picture resource generating the low resolution level of the first resolution level comprises: breadth first detects whether the low resolution level picture resources of the target picture resource exist in all the secondary resolution level resource files. If not, the step of generating the picture resources of the resolution level is performed, and then the next secondary resolution level resource file is checked. If so, checking the next secondary resolution level resource file until all the secondary resolution level resource files are detected, and executing the detection of the next picture resource.
For example, referring to fig. 7, after a target picture resource is acquired, it is detected whether or not there is a file name of the target picture resource in the buffer. If the file name of the target picture resource exists in the cache, the target picture resource is indicated to be processed, and then the next picture resource is detected. If the file name of the target picture resource does not exist in the cache, detecting whether the picture resource of the resolution level corresponding to the target picture resource exists in the secondary resolution level resource file corresponding to the target picture resource, if not, executing the step of generating the picture resource of the resolution level, and then checking the secondary resolution level resource file. If so, the secondary resolution level resource file is checked. And after all the next N-level resolution level resource files are detected, namely all the resolution level resource files are detected, executing the detection of the next picture resource.
Step 406, packaging the file of the application program to generate a file package of the application program; wherein the file of the application program comprises a picture resource file.
By means of the packing tool, the application program file can be packed, and then the application program file package is generated. The files of the application program can comprise files in the application program project, files obtained from a third party dependency library, and the generated multiple sets of picture resource files with different versions. Taking Android applications as an example, the files of the application program may be packaged using a resource processing Tool AAPT (Android ASSET PACKAGING Tool, an Zhuozi source packaging Tool), AAPT, and the like.
In summary, according to the technical scheme provided by the embodiment of the application, when the target picture resources with different resolution levels are generated, by detecting whether the target picture resources exist in the resource file, repeated generation of the target picture resources with different resolution levels is prevented, and redundant resource loss is reduced.
In addition, whether the target picture resource is processed is judged by detecting whether the file name of the target picture resource exists in the cache, and if so, a corresponding supplementary action is made, so that the integrity of the picture resource file is ensured, and the integrity of the application program file package is further improved.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Referring to fig. 8, a block diagram of a packaging apparatus for an application program according to an embodiment of the present application is shown. The device has the function of realizing the packaging method example of the application program, and the function can be realized by hardware or can be realized by executing corresponding software by hardware. The device may be a computer device or may be provided in a computer device. The apparatus 800 may include: a resource acquisition module 801, a resource generation module 802, and a file packaging module 803.
The resource obtaining module 801 is configured to obtain, in a project construction process of an application program, a picture resource set used by the application program, where the picture resource set includes picture resources in a third party dependency library.
A resource generating module 802, configured to generate a plurality of sets of picture resource sets with different versions based on the acquired picture resource set; wherein different versions correspond to different resolution levels.
A file packaging module 803, configured to package a file of the application program, and generate a file package of the application program; the file of the application program comprises a plurality of sets of picture resource sets with different versions.
In an exemplary embodiment, as shown in fig. 9, the resource obtaining module 801 includes: task Hook submodule 801a, catalog acquisition submodule 801b and resource set acquisition submodule 801c.
The task Hook submodule 801a is configured to Hook, during a project construction process of the application program, a merge resource task through a Hook function, where the merge resource task is a task for merging resources used by the application program.
A catalog acquisition sub-module 801b is configured to acquire a picture resource catalog of the application program before executing the merge resource task.
A resource obtaining submodule 801c, configured to obtain, based on the picture resource directory, the picture resource set used by the application program.
In an exemplary embodiment, the catalog acquisition sub-module 801b is configured to:
before executing the merge resource task, executing a custom task;
and calling a resource acquisition function through the custom task, wherein the resource acquisition function is used for acquiring a resource catalog of the application program, and the resource catalog comprises the picture resource catalog.
In one exemplary embodiment, the resource set generation module 802 includes:
a picture resource generation sub-module 802a, configured to generate, for a target picture resource of a first resolution level in the picture resource set, the target picture resource of a low resolution level of the first resolution level;
the picture resource storage sub-module 802b is configured to put the target picture resources of each resolution level into a resource folder corresponding to the resolution level. The resource folders of each resolution level are used for storing picture resource sets of one resolution level.
In an exemplary embodiment, the picture resource generating submodule 802a is configured to sequentially traverse, in order from high to low of the resolution levels, a resource folder corresponding to a resolution level lower than the first resolution level, and detect whether the resource folder contains the target picture resource of the corresponding resolution level; and if the resource folder does not contain the target picture resource with the corresponding resolution level, generating the target picture resource with the corresponding resolution level.
In an exemplary embodiment, the picture resource generation sub-module 802a is further configured to detect, after the target picture resource is obtained from the picture resource set, whether a file name of the target picture resource exists in a cache; the cache is used for storing file names of the processed picture resources; if the file name of the target picture resource does not exist in the cache, executing the step of generating the target picture resource of the low resolution level of the first resolution level; and if the file name of the target picture resource exists in the cache, acquiring the next picture resource from the picture resource set.
In an exemplary embodiment, a specified project file of the application program is added with a dependency on a specified plug-in, and the specified plug-in is used for acquiring a picture resource set used by the application program and generating a plurality of different versions of the picture resource set. The apparatus 800 further comprises: the plug-in executes module 804.
And the plug-in execution module 804 is configured to execute the specified plug-in the process of constructing the item of the application program.
In summary, according to the technical scheme provided by the embodiment of the application, in the project construction process of the application program, based on the picture resource sets corresponding to the application program, a plurality of sets of picture resource sets with different versions (i.e. different resolution levels) are generated, so that the automatic generation of a plurality of sets of picture resource sets with different versions is realized, manual configuration is not needed, and the configuration efficiency of the picture resource sets is further improved.
It should be noted that, when the apparatus provided in the foregoing embodiment performs the functions thereof, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to perform all or part of the functions described above. In addition, the apparatus and the method embodiments provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the apparatus and the method embodiments are detailed in the method embodiments and are not repeated herein.
In one exemplary embodiment, a computer device is provided that includes a processor and a memory having a computer program stored therein, the computer program loaded and executed by the processor to implement the method of packaging an application program described above.
In one exemplary embodiment, a computer readable storage medium is also provided, in which a computer program is stored, which when executed by a processor, implements the above-described method of packaging an application program.
In one exemplary embodiment, a computer program product or computer program is also provided, the computer program product or computer program comprising computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions so that the computer device performs the method of packaging an application program.
The foregoing description of the exemplary embodiments of the application is not intended to limit the application to the particular embodiments disclosed, but on the contrary, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the application.

Claims (8)

1. A method for packaging an application program, the method comprising:
in the project construction process of an application program, acquiring a picture resource set used by the application program, wherein the picture resource set comprises picture resources in a third-party dependency library; the method comprises the steps that dependence on a specified plug-in is added in a specified project file of an application program, the specified plug-in is used for acquiring a picture resource set used by the application program and generating a plurality of sets of picture resource sets with different versions, and the specified plug-in is automatically triggered and executed in the project construction process of the application program;
For target picture resources with a first resolution level in a picture resource set used by the application program, traversing resource folders corresponding to resolution levels lower than the first resolution level in sequence according to the sequence of the resolution levels from high to low, and judging whether the resource folders contain the target picture resources with the corresponding resolution levels by detecting whether the target picture resources with the corresponding file names exist in the resource folders; the resource folders corresponding to the resolution levels are used for storing picture resource sets of one resolution level, and picture resources with different file names and different formats do not exist in the resource folders;
If the resource folder does not contain the target picture resources with the corresponding resolution levels, generating the target picture resources with the corresponding resolution levels;
respectively placing the target picture resources of each resolution level into resource folders corresponding to the resolution levels to obtain a plurality of sets of picture resource sets of different versions, wherein the different versions correspond to different resolution levels;
Packaging the files of the application program to generate a file package of the application program; the file of the application program comprises a plurality of sets of picture resource sets with different versions, and an installation package which is generated based on the file package and provided for the user terminal is generated based on the picture resource set which is extracted from the file package and corresponds to the resolution level of the user terminal.
2. The method according to claim 1, wherein the obtaining the picture resource set used by the application program during the project construction of the application program includes:
Hooking a merging resource task through a Hook function in the project construction process of the application program, wherein the merging resource task is a task for merging resources used by the application program;
before executing the merge resource task, acquiring a picture resource catalog of the application program;
And acquiring the picture resource set used by the application program based on the picture resource catalog.
3. The method of claim 2, wherein the obtaining the picture resource catalog of the application program before performing the merge resource task comprises:
before executing the merge resource task, executing a custom task;
and calling a resource acquisition function through the custom task, wherein the resource acquisition function is used for acquiring a resource catalog of the application program, and the resource catalog comprises the picture resource catalog.
4. The method according to claim 1, wherein the method further comprises:
After acquiring the target picture resource from a picture resource set used by the application program, detecting whether a file name of the target picture resource exists in a cache; the cache is used for storing file names of the processed picture resources;
if the file name of the target picture resource does not exist in the cache, executing the steps of traversing the resource folders corresponding to the resolution levels lower than the first resolution level in sequence according to the order from high resolution level to low resolution level, and judging whether the resource folders contain the target picture resource with the corresponding resolution level by detecting whether the target picture resource with the corresponding file name exists in the resource folders;
And if the file name of the target picture resource exists in the cache, acquiring the next picture resource from the picture resource set.
5. An apparatus for packaging an application program, the apparatus comprising:
The resource acquisition module is used for acquiring a picture resource set used by the application program in the project construction process of the application program, wherein the picture resource set comprises picture resources in a third-party dependency library; the method comprises the steps that dependence on a specified plug-in is added in a specified project file of an application program, the specified plug-in is used for acquiring a picture resource set used by the application program and generating a plurality of sets of picture resource sets with different versions, and the specified plug-in is automatically triggered and executed in the project construction process of the application program;
The resource generation module is used for traversing resource folders corresponding to the resolution levels lower than the first resolution level in sequence from high resolution levels to low resolution levels for target picture resources with the first resolution level in the picture resource set used by the application program, and judging whether the resource folders contain the target picture resources with the corresponding resolution levels by detecting whether the target picture resources with the corresponding file names exist in the resource folders; the resource folders corresponding to the resolution levels are used for storing picture resource sets of one resolution level, and picture resources with different file names and different formats do not exist in the resource folders;
the resource generating module is further configured to generate the target picture resource with the corresponding resolution level if the resource folder does not contain the target picture resource with the corresponding resolution level;
the resource generation module is further configured to put the target picture resources of each resolution level into a resource folder corresponding to the resolution level, to obtain the multiple sets of picture resource sets of different versions, where the different versions correspond to different resolution levels;
The file packaging module is used for packaging the files of the application program and generating a file package of the application program; the file of the application program comprises a plurality of sets of picture resource sets with different versions, and an installation package which is generated based on the file package and provided for the user terminal is generated based on the picture resource set which is extracted from the file package and corresponds to the resolution level of the user terminal.
6. A computer device comprising a processor and a memory, the memory having stored therein a computer program that is loaded and executed by the processor to implement the method of packaging an application program as claimed in any one of claims 1 to 4.
7. A computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, the computer program being loaded and executed by a processor to implement the method of packaging an application program according to any one of claims 1 to 4.
8. A computer program product comprising computer instructions stored in a computer readable storage medium, from which a processor reads and executes the computer instructions to implement the method of any one of claims 1 to 4.
CN202010842561.1A 2020-08-20 2020-08-20 Application program packaging method, device, equipment and storage medium Active CN112000364B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010842561.1A CN112000364B (en) 2020-08-20 2020-08-20 Application program packaging method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010842561.1A CN112000364B (en) 2020-08-20 2020-08-20 Application program packaging method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112000364A CN112000364A (en) 2020-11-27
CN112000364B true CN112000364B (en) 2024-05-28

Family

ID=73472830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010842561.1A Active CN112000364B (en) 2020-08-20 2020-08-20 Application program packaging method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112000364B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289378A (en) * 2011-09-30 2011-12-21 互动在线(北京)科技有限公司 Method for automatically generating APP (Application)
CN107729041A (en) * 2017-07-26 2018-02-23 上海壹账通金融科技有限公司 The hot update method of application program, device, terminal and storage medium
CN108319460A (en) * 2018-01-24 2018-07-24 广东小天才科技有限公司 Generation method, device, electronic equipment and the storage medium of application program installation kit
CN109710265A (en) * 2018-12-28 2019-05-03 北京金山安全软件有限公司 Method and device for acquiring software installation package and electronic equipment
CN109857405A (en) * 2019-02-02 2019-06-07 Oppo广东移动通信有限公司 Compilation Method, device, storage medium and the terminal of application program installation kit
WO2020061731A1 (en) * 2018-09-25 2020-04-02 深圳市欢太科技有限公司 Resource processing method, electronic device, and computer-readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289378A (en) * 2011-09-30 2011-12-21 互动在线(北京)科技有限公司 Method for automatically generating APP (Application)
CN107729041A (en) * 2017-07-26 2018-02-23 上海壹账通金融科技有限公司 The hot update method of application program, device, terminal and storage medium
CN108319460A (en) * 2018-01-24 2018-07-24 广东小天才科技有限公司 Generation method, device, electronic equipment and the storage medium of application program installation kit
WO2020061731A1 (en) * 2018-09-25 2020-04-02 深圳市欢太科技有限公司 Resource processing method, electronic device, and computer-readable storage medium
CN109710265A (en) * 2018-12-28 2019-05-03 北京金山安全软件有限公司 Method and device for acquiring software installation package and electronic equipment
CN109857405A (en) * 2019-02-02 2019-06-07 Oppo广东移动通信有限公司 Compilation Method, device, storage medium and the terminal of application program installation kit

Also Published As

Publication number Publication date
CN112000364A (en) 2020-11-27

Similar Documents

Publication Publication Date Title
CN109885324B (en) Processing method, device, terminal and storage medium of application program installation package
CN108647527B (en) File packing method, file packing device, file unpacking device and network equipment
US8965890B2 (en) Context sensitive media and information
CN107526623B (en) Data processing method and device
CN112256990A (en) Image processing method and device and computer readable storage medium
CN111949611A (en) File processing method, system, device and medium
CN111694640A (en) Data processing method and device, electronic equipment and storage medium
CN110806913A (en) Webpage screenshot method, device and equipment
CN108958755B (en) Method and device for generating application program installation package and electronic equipment
CN112000364B (en) Application program packaging method, device, equipment and storage medium
CN106598614B (en) Method and device for recycling picture resources
WO2023143545A1 (en) Resource processing method and apparatus, electronic device, and computer-readable storage medium
CN116595086A (en) Method and system for realizing spatial data service based on plug-in
CN110889880A (en) Map processing method, device, equipment and storage medium
CN115062340A (en) Device access method, interface processing method and device
CN113129431A (en) Three-dimensional model processing method, high-speed browsing method, electronic device and storage medium
CN110502251B (en) Application installation method and device
CN113868479A (en) Method and device for processing service data
CN109684191B (en) Application package construction method, device and equipment and readable storage medium
CN114205645B (en) Distributed video content auditing method and device
CN110908958B (en) File processing method, device, terminal and storage medium
CN112558975B (en) Method and device for switching codes of components, electronic equipment and readable storage medium
CN114398073A (en) Application updating method and device based on RN
CN116708588A (en) File compression downloading method, device, equipment, medium and program product
CN111221738A (en) Data execution file generation method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant