CN112000364A - 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
CN112000364A
CN112000364A CN202010842561.1A CN202010842561A CN112000364A CN 112000364 A CN112000364 A CN 112000364A CN 202010842561 A CN202010842561 A CN 202010842561A CN 112000364 A CN112000364 A CN 112000364A
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.)
Granted
Application number
CN202010842561.1A
Other languages
Chinese (zh)
Other versions
CN112000364B (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

Images

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, equipment and a storage medium of an application program, and belongs to the technical field of computers and the 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 obtained 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. In the embodiment of the application, 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 in the project construction process of the application program, 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 improved.

Description

Application program packaging method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers and internet, in particular to a packaging method, a packaging device, packaging equipment and a storage medium of an application program.
Background
At present, electronic devices in the market have different resolutions, and developers propose a method for configuring multiple resolution levels for the same resource in order to adapt to electronic devices with various resolutions.
In the related art, taking the configuration of picture resources as an example, in the process of configuring picture resources by a developer, the developer needs to manually configure the picture resources of different resolution levels. The resolution levels of the picture resources may include multiple resolution levels, such as Ldpi (Low Dpi, Low resolution), Mdpi (Medium Dpi, Medium resolution), Hdpi (High Dpi, High resolution), and the like, and the developers need to manually configure the resolution levels into corresponding picture resource files.
However, the above process of manually configuring the picture resources is complex in operation and low in efficiency.
Disclosure of Invention
The embodiment of the application provides a packaging method, a packaging device, an application device and a storage medium for an application program, which can automatically configure picture resource sets of different versions (namely different resolution levels) and improve the efficiency of configuration of 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 method for packaging an application, 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 obtained 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; wherein the file of the application program comprises the plurality of sets of picture resource sets of different versions.
According to an aspect of an embodiment of the present application, there is provided an apparatus for packaging an application, the apparatus including:
the resource acquisition module is used for acquiring a picture resource set used by an application program in a 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 to generate a file package of the application program; wherein the file of the application program comprises the plurality of sets of picture resource sets of different versions.
According to an aspect of the embodiments of the present application, there is provided a computer device, the computer device includes a processor and a memory, the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the packaging method of the application program.
According to an aspect of embodiments of the present application, there is provided a computer-readable storage medium, in which a computer program is stored, the computer program being loaded and executed by a processor to implement the packaging method of the application program.
According to an aspect of embodiments herein, 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 to enable the computer device to execute 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 artificial configuration, and the configuration efficiency of the picture resource sets is 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 the file packaging efficiency of the application program is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic illustration of an environment for implementing an embodiment provided by an embodiment of the present application;
FIG. 2 is a flowchart of a packaging method for an application according to an embodiment of the present application;
FIG. 3 illustrates a diagram of pictures of different resolution levels;
FIG. 4 is a flowchart of a packaging method for an application according to another embodiment of the present application;
FIG. 5 illustrates a flow chart of a project building process for an application;
fig. 6 is a diagram illustrating a relationship between resolution and magnification of one picture resource;
FIG. 7 is a flowchart of detecting whether a picture resource is processed according to an embodiment of the present application;
FIG. 8 is a block diagram of an apparatus for packaging applications provided by one embodiment of the present application;
fig. 9 is a block diagram of an apparatus for packaging an application according to another embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Refer to fig. 1, which illustrates a schematic diagram of an environment for implementing an embodiment of the present application. The embodiment implementation environment may be implemented as an application download system. The embodiment implementation environment may include: 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 execute an application download operation on the application download platform 12. For example, the user terminal 11 may be a client installed with a target application program, and the user logs in the application download platform 12 through the client to perform an application download operation. The target Application may be any Application providing an Application download service, such as an APP (Application store), an APP of an Application management class, or other third-party applications with Application download capabilities, which is not limited in this embodiment of the present Application. The user terminal 11 may be an electronic device such as a mobile phone, a tablet computer, a multimedia player, a PC (personal computer), a wearable device, a smart television, and the like.
The application download platform 12 is a network platform for providing application download services, and the content downloaded by the application may include one or more installation packages associated with the application. The installation package may include configuration files, code files, resource files, and other files. In one example, the application download platform 12 is a network platform for providing download of video-class applications whose installation packages include, but are not limited to, configuration files, code files, resource files, and the like. Optionally, the application download platform 12 includes one or more servers 120, and the server 120 may be a background server of the target application program, and is used for providing a background service for the target application program.
The developer terminal 13 is a terminal device for providing a package of files to the application download platform 12. After the developer develops the application program on the developer terminal 13, the application program is packaged to generate a package of files of the application program, and the package of files is uploaded to the application download platform 12. The file package may include configuration files, code files, and resource files of the application, such as picture resource files including 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 an application download requirement of the user terminal 11, the application download platform 12 extracts a corresponding file from a 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 corresponding attributes 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 an installation package with resources with corresponding resolutions 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 resources having the resolution of Hdpi. Therefore, the size of the installation package volume can be effectively controlled, and the redundant resource overhead is reduced.
The user terminal 11 and the application download platform 12 can communicate with each other via a network, and the application download platform 12 and the developer terminal 13 can communicate with each other via a network.
Referring to fig. 2, a flowchart of a packaging method for an application according to an embodiment of the present application is shown. The execution subject 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 comprises the following steps (201-203):
step 201, in the project building process of the application program, obtaining a picture resource set used by the application program, where the picture resource set includes picture resources in a third-party dependency library.
In the embodiment of the application, the project building process of the application includes a process of creating a project of the application, 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 the classification, and generating a file package. The file may also be obtained from a third-party dependent library, and thus the file package may include the original file in the project and the file obtained from the third-party dependent library. The file may be a file such as a configuration file, a code file, a resource file, etc. The resource files comprise picture resource files, character resource files, video resource files and the like.
The picture resource set includes a plurality of picture resources used by the application. In the case of using a picture Format as a classification standard, one picture resource set may include at least one of picture resources in BMP (Bitmap), JPEG (Joint Photographic Experts Group), GIF (Graphics Interchange Format), and other formats. In the case of using the picture resolution level as the classification criterion, one picture resource set may include at least one of picture resources at resolution levels, such as Ldpi (Low Dpi, Low resolution), Mdpi (Medium Dpi, Medium resolution), and Hdpi (High Dpi, High resolution), and the embodiments of the present application are not limited herein.
The third-party dependent library refers to a dependent library other than the item dependent library of the application program. The third-party dependency library can store resources required by the application program, such as picture resources, and can acquire the required resources from the third-party dependency library based on project building requirements of the application program. Alternatively, the third party dependency library may be one or more dependency libraries that store the resources required to build the application project. Alternatively, the resource in the third party dependent library may be a resource in Aar (Android Archive) package, Jar (Java Archive) package, 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 the different versions correspond to different resolution levels.
In the application embodiment, the acquired picture resource set includes picture resources originally in the application program project and picture resources acquired from a third-party dependency library. Optionally, the picture resource set may include picture resources of different resolution levels, such as resolution levels of Mdpi, Hdpi, Ldpi, and so on. For example, as shown in fig. 3, the resolution levels of the picture resource set include Xxhdpi (192 × 192), Xxhdpi (144 × 144), Xhdpi (96 × 96), Hdpi (72 × 72), and Mdpi (48 × 48).
Optionally, in a project building process of an application program, a picture resource set used by the application program may be obtained by a specified plug-in, and a plurality of sets of picture resource sets of different versions are generated based on the picture resource set. The method comprises the steps that a dependency on a specified plug-in is added in a specified project file of an application program, and the specified plug-in is used for obtaining 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 a resizemage plug-in (namely the specified plug-in) is added in a project file constructed by the Gradle, the resizemage plug-in is placed in a Gradle.properties file of a Module layer, when the Gradle packs a Bundle, the dependency is automatically triggered, namely the resizemage plug-in is automatically called, a picture resource set used by an application program is obtained through the resizemage plug-in, and a plurality of sets of picture resource sets of 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 generation process of the picture resource sets of different versions may be to compress 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 at an Xxhdpi (144 × 144) resolution level, and the specified plug-in is called to reduce the resolution level of the picture resource by 30%, so that the picture resource at the Xxhdpi (144 × 144) resolution level can be obtained. The designated plug-in is called to reduce the resolution level of the picture resource set by 70%, and the picture resource with the resolution level of Mdpi (48 × 48) can be obtained.
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 the embodiment of the application, the files of the application include files in the project of the application and files obtained from a third-party dependent library. The file may include a configuration file, a code file, a resource file, 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 then the file package of the application program is generated, wherein the file package comprises the files corresponding to 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, a plurality of sets of picture resource sets of 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 of different versions is realized without artificial 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 the file packaging efficiency of the application program is improved.
In addition, the process of automatically generating the multiple 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 the third-party dependency library and subjected to resolution compression operation, and the completeness of the picture resource obtaining is improved.
Referring to fig. 4, a flowchart of a packaging method for an application according to another embodiment of the present application is shown. The execution subject 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 can comprise the following steps (401-406):
step 401, hooking the merged resource task through the Hook function in the project building process of the application program.
In the embodiment of the present application, the merged 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 characters, pictures, videos and the like corresponding to the application program, and the resources used by the application program may include resources in application program projects, resources acquired from a third-party dependency library, and different versions of picture resource sets generated in the following steps.
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 a project building process of Gradle, before a final Bundle is built, a merged resource task, namely, mergeresourceTsak, is executed, and the merged resource task is used for compressing resources in a project according to categories to generate a compressed file packet base. But before executing the merger resource task mergeresourceTsak, the merger resource task merger resource Tsak is held by Hook via a Hook function, and a custom task is inserted, wherein the custom task can comprise resolution compression of picture resources and distribution of the picture resources subjected to resolution compression to each resolution folder.
Referring to FIG. 5, a flow diagram of a project building process for an application is illustrated. The project construction process of the application program mainly comprises the steps of creating an anchor task, combining resource tasks, Res (Resources) file processing tasks, constructing packaging tasks and the like. In the embodiment of the present application, in the project construction of the application program, the merged resource task 51 is hooked through a Hook function, the merged resource task 51 is suspended, a new custom task is executed to generate picture resource sets of different resolution levels, and after the picture resource sets of different resolution levels are generated, the merged resource task 51 is resumed to be executed downwards.
Step 402, calling a resource obtaining function through the custom task, wherein the resource obtaining function is used for obtaining a resource directory of the application program, and the resource directory comprises a picture resource directory.
Optionally, before executing the merged resource task, a custom task is executed, the custom task including invoking a resource acquisition function. The resource obtaining function is used for obtaining a resource directory of the application program, and the resource directory comprises a picture resource directory. Taking an android application as an example, before a Hook merge resource task, MergeResourceTask, a getrawnandriod resources () function (i.e., the above resource acquisition function) is called to acquire a resource directory of an application program.
The resource directory of the application refers to a directory of resource files of the application. The resource directory may record a file name and a file address of each resource file, or other file information, which is not limited herein in this embodiment of the present application. The picture resource directory refers to a folder for storing picture resources. Optionally, the picture resource directory may include a file name and a file address of each picture resource.
Step 403, based on the picture resource catalog, obtaining a picture resource set used by the application program.
Optionally, the picture resource set used by the application program may be obtained according to the file name and the file address of the picture resource recorded in the picture resource directory.
Step 404, based on the target picture resource at the first resolution level in the picture resource set, generating a target picture resource at a low resolution level at the first resolution level.
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. Based on the target picture resource, the copying operation is carried out, then the resolution level compression operation is carried out on the copied target picture resource, a new target picture resource, namely the picture resource with a low resolution level, is generated and then is stored.
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. Optionally, the process may generate a plurality of different low resolution levels of the target picture resource below the first resolution level, according to the requirements of the application. For example, referring to fig. 3, the resolution level of the target picture asset is Xhdpi (144 × 144), and based on the target picture asset, it may also generate picture assets at 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 occupied volume of the picture resources at the Xhdpi resolution level is higher than the occupied volume of the picture resources at the Hdpi resolution level. Referring to fig. 6, when the resolution at the level of the xhdpi resolution is 1080 × 1920, the magnification is 12, when the resolution at the level of the Hdpi resolution is 480 × 480, the magnification is 6, and the magnification of the picture assets at the level of the xhdpi resolution is 2 times that of the picture assets at the level of the Hdpi resolution, that is, the picture assets at the level of the xhdpi resolution occupy a volume 1 times larger than the volume occupied by the picture assets at the level of the Hdpi resolution. The size of the magnification of the picture resource is positively correlated with the occupied volume of the picture resource, for example, if the magnification of the picture resource a is 2 times of the magnification of the picture resource B, the occupied volume of the picture resource a is 2 times of the occupied volume of the picture resource B.
Alternatively, picture resources of different resolution levels may be stored in resource folders of corresponding resolution levels. And storing a picture resource with a resolution level in a resource folder with the resolution level. The name of the resource folder may be the resolution level of the stored picture resource. Optionally, based on the number of categories of the picture resource resolution levels, a corresponding number of resource folders are generated.
In one example, the specific content of the target picture resource generating 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 sequence of the resolution levels from high to low, and detecting whether the resource folders contain target picture resources of the corresponding resolution levels; 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; if the resource folder contains the target picture resource with the corresponding resolution level, the target picture resource with the corresponding resolution level does not need to be generated, and the detection of the next resource folder can be directly carried out. For example, referring to fig. 3, the resolution level of the target picture asset is Xhdpi (144 × 144), the picture assets at the Xhdpi (96 × 96) resolution level are detected from top to bottom according to the resolution level, and when it is detected that the picture assets at the Xhdpi (96 × 96) resolution level are not included in the Xhdpi (96 × 96) resolution level asset folder, the picture assets at the Xhdpi (96 × 96) resolution level are copied and generated, and stored in the Xhdpi (96) resolution level asset folder. When detecting that the Hdpi (72 × 72) resolution level resource folder contains the picture resource of the Hdpi (72 × 72) resolution level, the next resource folder can be directly detected without copying and generating the picture resource of the Hdpi (72 × 72) resolution level.
Optionally, in this embodiment of the present application, in order to avoid distortion of the interface display, an operation of copying the picture resource to the target picture resource at the high resolution level is not performed.
Optionally, 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 if 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 can be determined that the target picture resource of the resolution level already exists, and the operation of generating the target picture resource of the resolution level is not required. If the target picture resource with the file name of A and corresponding resolution level does not exist in the resource folder with the secondary resolution level, the operation of generating the target picture resource with the resolution level is carried out, and the file name of the target picture resource is named as A. Therefore, the picture resources with the same file name but different formats in one resource folder can be avoided.
Optionally, according to the above mentioned specified plug-in, a picture resource set used by the application program may be obtained, and copying and resolution level compression operations may be performed to generate multiple sets of picture resource sets of different versions. For example, taking an android application as an example, in the process of generating a plurality of sets of picture resource sets of different versions, a Python script is called to perform resolution level compression on picture resources, and the picture resources are copied to resource folders corresponding to resolution levels for summarizing. Alternatively, the compression tool may also employ local compression or Webp (webpy, a picture file format) formatting. It should be noted that picture resources in different formats can be generated according to different compression tools, but in one resource folder, picture resources in different formats of the same file name are not allowed to be generated, so that type interference can be prevented. Taking android application as an example, if a resource folder includes an a.png resource picture, an a.webp resource picture cannot be regenerated in the resource folder.
Step 405, the target picture resources of each resolution level are respectively placed into the resource folders of the corresponding resolution levels.
Alternatively, 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 resource 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 completely. Alternatively, it may be confirmed whether the target picture resource has been processed by detecting whether the file name of the target picture resource exists in the cache.
In one example, after a target picture resource is obtained from a picture resource set, whether a file name of the target picture resource exists in a cache is detected; the cache is used for storing the 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 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 generation of the target picture resource of the low resolution level of the first resolution level comprises: and the breadth first detects whether the picture resource with the low resolution level of the target picture resource exists in all the secondary resolution level resource files. If not, executing the step of generating the picture resource of the resolution level, and then checking the next level of resolution level resource file. If yes, checking the next sub-resolution level resource file until all the sub-resolution level resource files are detected completely, and executing the next picture resource detection.
For example, referring to fig. 7, after the target picture resource is acquired, it is detected whether the file name of the target picture resource exists in the cache. And if the file name of the target picture resource exists in the cache, the target picture resource is processed completely, and then the next picture resource is detected. If the file name of the target picture resource does not exist in the cache, whether the picture resource of the resolution level corresponding to the target picture resource exists in the next level resolution level resource file corresponding to the target picture resource is detected, if not, the step of generating the picture resource of the resolution level is executed, and then the next level resolution level resource file is checked. If so, the sub-secondary resolution level resource file is checked. And after the N-level resolution level resource files are completely detected, namely all the resolution level resource files are completely detected, executing the next picture resource detection.
Step 406, packaging the files of the application program to generate a file package of the application program; the file of the application program comprises a picture resource file.
By means of the packaging tool, the files of the application program can be packaged, and then the file package of the application program is generated. The files of the application program can comprise files in the application program project, files acquired from a third-party dependency library, a plurality of sets of generated picture resource files with different versions and the like. Taking Android applications as an example, the Packaging operation of the files of the application program can be performed by using an Asset Packaging Tool AAPT (Android Asset Packaging Tool), AAPT2, and the like.
To sum up, according to the technical scheme provided by the embodiment of the application, when the target picture resources with different resolution levels are generated, the target picture resources with different resolution levels are prevented from being repeatedly generated by detecting whether the target picture resources exist in the resource file, and the loss of redundant resources is reduced.
In addition, whether the file name of the target picture resource exists in the cache or not is detected, whether the target picture resource is processed or not is judged, and if the target picture resource is processed, corresponding supplementary actions are performed, so that the integrity of the picture resource file is ensured, and the integrity of the application program file package is improved.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 8, a block diagram of an apparatus for packaging an application according to an embodiment of the present application is shown. The device has the function of realizing the example of the packaging method of the application program, and the function can be realized by hardware or by hardware executing corresponding software. The device can be a computer device and can also be arranged in the 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 building 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 generation module 802, configured to generate multiple sets of picture resource sets of different versions based on the obtained picture resource set; wherein the 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; wherein the file of the application program comprises the plurality of sets of picture resource sets of different versions.
In an exemplary embodiment, as shown in fig. 9, the resource obtaining module 801 includes: a task Hook sub-module 801a, a catalog acquisition sub-module 801b and a resource set acquisition sub-module 801 c.
The task Hook submodule 801a is configured to Hook a merged resource task through a Hook function in a project building process of the application program, where the merged resource task is a task for merging resources used by the application program.
The directory obtaining sub-module 801b is configured to obtain a picture resource directory of the application program before the merged resource task is executed.
The resource obtaining sub-module 801c is configured to obtain the picture resource set used by the application program based on the picture resource directory.
In an exemplary embodiment, the catalog retrieval sub-module 801b is configured to:
executing a custom task before executing the merged resource task;
and calling a resource acquisition function through the custom task, wherein the resource acquisition function is used for acquiring a resource directory of the application program, and the resource directory comprises the picture resource directory.
In an exemplary embodiment, the resource set generation module 802 includes:
a picture resource generating sub-module 802a, configured to generate, for a target picture resource at a first resolution level in the picture resource set, the target picture resource at a low resolution level of the first resolution level;
the picture resource storage sub-module 802b is configured to place the target picture resources at each resolution level into the resource folders corresponding to the resolution levels, respectively. And the resource folder of each resolution level is used for storing a picture resource set of one resolution level.
In an exemplary embodiment, the picture resource generating sub-module 802a is configured to sequentially traverse resource folders corresponding to resolution levels lower than the first resolution level according to the order from high to low of the resolution levels, and detect whether the resource folders contain the target picture resources at corresponding resolution levels; and if the target picture resources with the corresponding resolution levels are not contained in the resource folder, generating the target picture resources with the corresponding resolution levels.
In an exemplary embodiment, the picture resource generation sub-module 802a is further configured to detect whether a file name of the target picture resource exists in a cache after the target picture resource is obtained from the picture resource set; the cache is used for storing the 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 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.
In an exemplary embodiment, a dependency on a specified plug-in is added to a specified project file of the application program, and 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 of different versions. The apparatus 800 further comprises: and a plug-in execution module 804.
And the plug-in execution module 804 is used for executing the specified plug-in the project building process 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, a plurality of sets of picture resource sets of 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 of different versions is realized without artificial configuration, 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 implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
In one exemplary embodiment, a computer device is provided, which includes 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 above application program.
In an 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 packaging method of the above-described application program.
In an exemplary embodiment, a computer program product or a computer program is also provided, which comprises computer instructions, which are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and executes the computer instructions, so that the computer device executes the packaging method of the application program.
The above description is only exemplary of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements and the like that are made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A method for packaging an application, 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;
generating a plurality of sets of picture resource sets with different versions based on the obtained 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; wherein the file of the application program comprises the plurality of sets of picture resource sets of different versions.
2. The method according to claim 1, wherein the obtaining a picture resource set used by an application program in a project building process of the application program comprises:
hooking a merged resource task through a Hook function in the project construction process of the application program, wherein the merged resource task is a task for merging resources used by the application program;
before executing the resource merging task, acquiring a picture resource directory 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 obtaining the picture resource directory of the application program before executing the merged resource task comprises:
executing a custom task before executing the merged resource task;
and calling a resource acquisition function through the custom task, wherein the resource acquisition function is used for acquiring a resource directory of the application program, and the resource directory comprises the picture resource directory.
4. The method of claim 1, wherein generating multiple sets of picture resource sets of different versions based on the obtained picture resource set comprises:
generating a target picture resource of a low resolution level of a first resolution level in the picture resource set for the target picture resource of the first resolution level;
respectively placing the target picture resources of each resolution level into resource folders corresponding to the resolution levels;
and the resource folder of each resolution level is used for storing a picture resource set of one resolution level.
5. The method of claim 4, wherein the generating the target picture resource at a low resolution level of the first resolution level comprises:
sequentially traversing resource folders corresponding to resolution levels lower than the first resolution level according to the sequence of the resolution levels from high to low, and detecting whether the resource folders contain the target picture resources of the corresponding resolution levels;
and if the target picture resources with the corresponding resolution levels are not contained in the resource folder, generating the target picture resources with the corresponding resolution levels.
6. The method of claim 4, further comprising:
after the target picture resource is acquired from the picture resource set, detecting whether the file name of the target picture resource exists in a cache or not; the cache is used for storing the 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 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.
7. The method according to any one of claims 1 to 6, characterized in that a dependency on a specified plug-in is added to a specified project file of the application program, wherein 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 of different versions;
the method further comprises the following steps:
and executing the specified plug-in the project building process of the application program.
8. An apparatus for packaging an application, the apparatus comprising:
the resource acquisition module is used for acquiring a picture resource set used by an application program in a 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 to generate a file package of the application program; wherein the file of the application program comprises the plurality of sets of picture resource sets of different versions.
9. A computer device, characterized in that it comprises a processor and a memory, in which a computer program is stored, which computer program is loaded and executed by the processor to implement the packaging method of an application program according to any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored, which is loaded and executed by a processor to implement the packaging method of an application program according to any one of claims 1 to 7.
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 true CN112000364A (en) 2020-11-27
CN112000364B 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
CN112000364B (en) 2024-05-28

Similar Documents

Publication Publication Date Title
CN109885324B (en) Processing method, device, terminal and storage medium of application program installation package
US8965890B2 (en) Context sensitive media and information
CN110347341B (en) Data clearing method and control equipment
CN107526623B (en) Data processing method and device
CN110806913A (en) Webpage screenshot method, device and equipment
CN111949611A (en) File processing method, system, device and medium
CN110865981A (en) File access method for mobile terminal and mobile terminal thereof
CN112000364B (en) Application program packaging method, device, equipment and storage medium
CN116595086A (en) Method and system for realizing spatial data service based on plug-in
CN111597020A (en) Application Programming Interface (API) debugging method and debugging terminal
CN115640066A (en) Security detection method, device, equipment and storage medium
CN115062340A (en) Device access method, interface processing method and device
CN115426375A (en) Data processing method and data processing system
CN113868479A (en) Method and device for processing service data
CN114205645B (en) Distributed video content auditing method and device
CN112558975B (en) Method and device for switching codes of components, electronic equipment and readable storage medium
CN110908958B (en) File processing method, device, terminal and storage medium
CN114519039B (en) Data online management method and device, terminal equipment and storage medium
CN118093010A (en) Application package generation method and device
CN114398073A (en) Application updating method and device based on RN
CN115878585A (en) HDFS empty directory positioning method, device, equipment and medium
CN107659539A (en) Method for auditing safely and device
CN117215616A (en) Data processing method, device, equipment and readable storage medium
CN115607970A (en) Game updating processing method, device, equipment and storage medium
CN116107599A (en) Installation package optimization method and device, electronic 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