A method and device for generating and processing program installation files
By compressing and converting the files to be compressed in the APK file on the Android platform, a smaller program installation file is generated, which solves the problem of reduced download and installation speed caused by the increase in the APK file size and improves the user experience.
Patent Information
- Application Number
- CN201911151009.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-21
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2040-12-06
AI Technical Summary
Due to the continuous increase in code and resources of APK files on Android platform, the file size increases, affecting the download and installation rate and reducing the user experience.
By determining the files to be compressed in the file to be packaged, and using a preset compression method to compress, generate the compressed file, and then convert it into a dynamic library file. Finally, the non-compressed files and dynamic library files in the file to be packaged are packaged to generate a smaller program installation file.
Reduce the size of program installation files, improve download and installation speed, save network resources, and improve user experience.
Smart Images

Figure CN112825035B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a method and device for generating and processing program installation files. Background Art
[0002] In the Android platform, all files of an application are compiled and packaged into an APK (Android application package) executable file in the APK format. The APK file can be used to distribute and install applications based on the Android platform. As the project is constantly upgraded and iterated, codes and resources are accumulated, making the APK file larger and larger. When users obtain the APK file, it not only consumes traffic resources but also increases the download time, thereby reducing the installation rate of the application and affecting the user experience. Summary of the invention
[0003] In view of this, an embodiment of the present application provides a method and device for generating and processing a program installation file, so as to reduce the size of the program installation file, increase the download rate of the program installation file, and save network resources.
[0004] To solve the above problems, the technical solutions provided in the embodiments of the present application are as follows:
[0005] A method for generating a program installation file, the method comprising:
[0006] Determine the files to be compressed in the files to be packaged;
[0007] Performing a first compression operation on the file to be compressed using a preset compression method to generate a compressed file;
[0008] Converting the compressed file into a first dynamic library file;
[0009] The non-to-be-compressed files in the to-be-packaged files and the first dynamic library file are packaged to generate a first program installation file.
[0010] In a possible implementation, determining the to-be-compressed files in the to-be-packaged files includes:
[0011] Obtain a predefined file to be compressed in the file to be packaged;
[0012] and / or,
[0013] The file size of each to-be-packaged file is obtained, and the to-be-packaged files whose file sizes exceed a threshold are determined as to-be-compressed files.
[0014] In a possible implementation, before determining the files to be compressed in the files to be packaged, the method further includes:
[0015] Compile the class file to generate an Android executable file, and determine the Android executable file as a file to be packaged, or decompress the second program installation file to obtain the Android executable file, and determine the Android executable file as a file to be packaged.
[0016] In a possible implementation, when the to-be-compressed file is a file of a dynamic library type, converting the compressed file into a first dynamic library file includes:
[0017] Deleting the last level extension of the compressed file to obtain a first dynamic library file;
[0018] When the to-be-compressed file is a file of a non-dynamic library type, converting the compressed file into a first dynamic library file comprises:
[0019] The last level extension of the compressed file is replaced with an extension of the dynamic library type to obtain a first dynamic library file.
[0020] In a possible implementation, the step of packaging the non-to-be-compressed files in the to-be-packaged files and the first dynamic library file to generate the first program installation file includes:
[0021] Perform a second compression operation on the second dynamic library file in the non-to-be-compressed file in the to-be-packaged file and the first dynamic library file to generate a third dynamic library file;
[0022] The other non-to-be-compressed files and the third dynamic library file are packaged to generate a first program installation file.
[0023] A method for processing a program installation file, the method comprising:
[0024] Unpacking the program installation file to obtain a first dynamic library file;
[0025] The first dynamic library file is subjected to a first decompression operation using a preset decompression method.
[0026] In a possible implementation, the unpacking operation on the program installation file to obtain the first dynamic library file includes:
[0027] Unpacking the program installation file to obtain a third dynamic library file;
[0028] A first dynamic library file is determined from the third dynamic library file.
[0029] In a possible implementation, determining the first dynamic library file from the third dynamic library file includes:
[0030] The third dynamic library file is subjected to a second decompression operation, and the first dynamic library file is identified from the files of the dynamic library type obtained by the second decompression operation.
[0031] In a possible implementation, performing a first decompression operation on the first dynamic library file in a preset decompression manner includes:
[0032] Identify the original file type corresponding to the first dynamic library file;
[0033] When it is identified that the original file type corresponding to the first dynamic library file is a dynamic library type, directly performing a first decompression operation on the first dynamic library file in a preset decompression manner to obtain a file of the dynamic library type;
[0034] When it is identified that the original file type corresponding to the first dynamic library file is a non-dynamic library type, the first dynamic library file is subjected to a first decompression operation using a preset decompression method, and the last level extension of the dynamic library type file obtained by the first decompression operation is deleted to obtain a file of the original file type.
[0035] In a possible implementation, the identifying the original file type corresponding to the first dynamic library file includes:
[0036] Query the corresponding original file type according to the file name corresponding to the first dynamic library file;
[0037] or,
[0038] Identify the file type flag in the first dynamic library file, and determine the original file type corresponding to the first dynamic library file;
[0039] or,
[0040] When the first dynamic library file only includes an extension of the dynamic library type, the original file type corresponding to the first dynamic library file is identified as the dynamic library type; when the first dynamic library file includes an extension of the dynamic library type and an extension of the non-dynamic library type, the original file type corresponding to the first dynamic library file is identified based on the included extension of the non-dynamic library type.
[0041] A device for generating a program installation file, the device comprising:
[0042] A determination unit, used for determining the files to be compressed in the files to be packaged;
[0043] A first generating unit, configured to perform a first compression operation on the file to be compressed using a preset compression method to generate a compressed file;
[0044] A conversion unit, used for converting the compressed file into a first dynamic library file;
[0045] The second generating unit is used to package the non-to-be-compressed files in the to-be-packaged files and the first dynamic library file to generate a first program installation file.
[0046] In a possible implementation, the determining unit is specifically configured to obtain predefined to-be-compressed files from the to-be-packaged files; and / or obtain the file size of each to-be-packaged file, and determine the to-be-packaged files whose file size exceeds a threshold as to-be-compressed files.
[0047] In a possible implementation manner, the device further includes:
[0048] A third generating unit is used for compiling the class file into an Android executable file before executing the determining unit, and determining the Android executable file as a file to be packaged, or
[0049] The acquisition unit is used to decompress the second program installation file to obtain an Android executable file, and determine the Android executable file as a file to be packaged.
[0050] In a possible implementation, when the file to be compressed is a file of a dynamic library type, the conversion unit is specifically used to delete the last level extension of the compressed file to obtain a first dynamic library file;
[0051] When the file to be compressed is a file of a non-dynamic library type, the conversion unit is specifically configured to replace the last level extension of the compressed file with an extension of a dynamic library type to obtain a first dynamic library file.
[0052] In a possible implementation, the second generating unit specifically includes:
[0053] A first generating sub-unit is used for performing a second compression operation on the second dynamic library file in the non-to-be-compressed file in the to-be-packaged file and the first dynamic library file to generate a third dynamic library file;
[0054] The second generating sub-unit is used to package other non-to-be-compressed files and the third dynamic library file to generate a first program installation file.
[0055] A device for processing program installation files, the device comprising:
[0056] An unpacking unit, used to unpack the program installation file to obtain a first dynamic library file;
[0057] The decompression unit is used to perform a first decompression operation on the first dynamic library file using a preset decompression method.
[0058] In a possible implementation, the unpacking unit includes:
[0059] The unpacking subunit is used to unpack the program installation file to obtain a third dynamic library file;
[0060] The determination subunit is used to determine the first dynamic library file from the third dynamic library file.
[0061] In a possible implementation, the determining subunit is specifically configured to perform a second decompression operation on the third dynamic library file, and identify the first dynamic library file from a file of a dynamic library type obtained by the second decompression operation.
[0062] In a possible implementation, the decompression unit includes:
[0063] An identification subunit, used to identify the original file type corresponding to the first dynamic library file;
[0064] A first decompression subunit is used for, when recognizing that the original file type corresponding to the first dynamic library file is a dynamic library type, directly performing a first decompression operation on the first dynamic library file in a preset decompression manner to obtain a file of the dynamic library type;
[0065] The second decompression sub-unit is used to, when recognizing that the original file type corresponding to the first dynamic library file is a non-dynamic library type, perform a first decompression operation on the first dynamic library file using a preset decompression method, delete the last level extension of the dynamic library type file obtained by the first decompression operation, and obtain a file of the original file type.
[0066] In a possible implementation, the identification subunit is specifically used to query the corresponding original file type according to the file name corresponding to the first dynamic library file; or, identify the file type flag in the first dynamic library file to determine the original file type corresponding to the first dynamic library file; or, when the first dynamic library file only includes an extension of the dynamic library type, identify the original file type corresponding to the first dynamic library file as the dynamic library type; when the first dynamic library file includes an extension of the dynamic library type and an extension of a non-dynamic library type, identify the original file type corresponding to the first dynamic library file according to the included extension of the non-dynamic library type.
[0067] A device for generating a program installation file includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0068] Determine the files to be compressed in the files to be packaged;
[0069] Performing a first compression operation on the file to be compressed using a preset compression method to generate a compressed file;
[0070] Converting the compressed file into a first dynamic library file;
[0071] The non-to-be-compressed files in the to-be-packaged files and the first dynamic library file are packaged to generate a first program installation file.
[0072] A computer-readable medium stores instructions which, when executed by one or more processors, enable a device to execute the method for generating a program installation file.
[0073] A processing device for program installation files includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0074] Unpacking the program installation file to obtain a first dynamic library file;
[0075] The first dynamic library file is subjected to a first decompression operation using a preset decompression method.
[0076] A computer-readable medium stores instructions which, when executed by one or more processors, enable a device to execute the method for processing program installation files.
[0077] It can be seen that the embodiments of the present application have the following beneficial effects:
[0078] In the embodiment of the present application, before packaging and generating a program installation file, the to-be-compressed files in the to-be-packaged files are first determined, and the to-be-compressed files are subjected to a first compression operation using a preset compression method to generate a compressed file, and then the compressed file is converted into a first dynamic library file. Finally, the non-to-be-compressed files and the first dynamic library file in the to-be-packaged files are packaged to generate a first program installation file. That is, for the larger files in the to-be-packaged files, i.e., the to-be-compressed files, a compression algorithm with a high compression ratio can be used to perform a first compression operation, thereby significantly reducing the to-be-compressed files, and then reducing the first program installation file after packaging. When the user needs to install the application corresponding to the first program installation file, the first program installation file can be directly downloaded. Since the first program installation file is relatively small, network resources can be saved, and the installation speed and user experience can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1An application scenario embodiment provided for the embodiments of the present application;
[0080] Figure 2 A flowchart of a method for generating a program installation file provided in an embodiment of the present application;
[0081] Figure 3 A generation framework diagram of a program installation file provided in an embodiment of the present application;
[0082] Figure 4 A flowchart of a method for processing program installation files provided in an embodiment of the present application;
[0083] Figure 5 A processing framework diagram of a program installation file provided in an embodiment of the present application;
[0084] Figure 6 A structural diagram of a device for generating a program installation file provided in an embodiment of the present application;
[0085] Figure 7 A structural diagram of a program installation file processing device provided in an embodiment of the present application;
[0086] Figure 8 A server structure diagram provided for an embodiment of the present application;
[0087] Fig. 9 A structural diagram of another device for processing program installation files provided in an embodiment of the present application. DETAILED DESCRIPTION
[0088] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0089] To facilitate understanding of the technical solution provided by this application, the background technology of this application will be described below.
[0090] The inventor found in the study of traditional APK file reduction methods that traditional reduction methods mainly focus on cutting useless resources, splitting dex files, and removing redundant native libraries. Among them, removing redundant natives refers to generating corresponding dynamic library (native library) files according to the CPU instruction set, and removing unnecessary native library files. For example, there are different instruction sets such as x86, arm, arm-v7, arm64-v8a, etc., and it is necessary to compile and generate a dynamic library file for each instruction set. However, the number of Android devices using the x86 instruction set is very small, so the dynamic library file corresponding to the instruction set can be omitted, which will reduce the size of the installation file. However, with the continuous upgrading of applications, the corresponding codes and resources are also increasing. The traditional reduction method cannot effectively slim down the APK file, affecting the download and installation of the APK file.
[0091] Based on this, an embodiment of the present application provides a method for generating a program installation file. Before generating the program installation file, the files to be compressed in the files to be packaged are first determined, that is, the relatively large files in the files to be packaged are determined as the files to be compressed. Then, a first compression operation is performed on the compressed files using a preset compression method to generate a compressed file. That is, a preset compression method is used to compress larger files to reduce the storage resources occupied by larger files. At the same time, the compressed file is converted into a first dynamic library file, and the non-to-be-compressed files and the first dynamic files in the files to be packaged are packaged to generate a first program installation file. That is, through the method provided in the embodiment of the present application, a compression operation with a high compression ratio can be performed on the compressed files, so that the first program installation file generated by packaging is smaller, reducing the user's consumption of network resources during installation, and increasing the installation rate.
[0092] For ease of understanding of the embodiments of this application, see Figure 1 , which is a schematic diagram of a framework of an exemplary application scenario provided by an embodiment of the present application. The method for generating a program installation file provided by an embodiment of the present application can be applied to a server 20.
[0093] Specifically, the server 20 can obtain the files to be packaged, and determine the files to be compressed from the files to be packaged, that is, determine the large files to be compressed. Then, a first compression operation is performed on the files to be compressed using a preset compression method to generate a compressed file, and the compressed file is converted into a first dynamic library file. Then, the non-to-be-compressed files in the files to be packaged and the first dynamic library file are packaged to generate a first program installation file.
[0094] When the user uses the terminal 10 to install the first program installation file, the first program installation file can be downloaded from the server 20 to the local computer, and the first program installation file can be unpacked to obtain the first dynamic library file. At the same time, the first dynamic library file can be decompressed using a preset decompression method to obtain an operable file, thereby implementing the installation of the application program.
[0095] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.
[0096] It should be noted that the terminal 10 can be any user device that is currently available, under development, or developed in the future, and can interact with each other through any form of wired and / or wireless connection (e.g., Wi-Fi, LAN, cellular, coaxial cable, etc.), including but not limited to: smart wearable devices, smart phones, non-smart phones, tablet computers, laptop personal computers, desktop personal computers, minicomputers, mid-range computers, mainframe computers, etc. that are currently available, under development, or developed in the future. The implementation of the present application is not limited in this regard. It should also be noted that the server 20 in the embodiment of the present application can be an example of a device that is currently available, under development, or developed in the future, and can provide application download services to users. The implementation of the present application is not limited in this regard.
[0097] To facilitate understanding of the technical solution provided in the embodiment of the present application, the generation method provided in the embodiment of the present application will be described below in conjunction with the accompanying drawings.
[0098] See also Figure 2 , which is a flow chart of a method for generating a program installation file provided in an embodiment of the present application, such as Figure 2 As shown, the method may include:
[0099] S201: Determine the files to be compressed in the files to be packaged.
[0100] Before packaging the files to be packaged, in order to reduce the storage space occupied by the packaged files, the files to be compressed are first determined from the files to be packaged. In the Android platform, the files to be packaged may include the classes.dex file, the resources.arsc file, and the files in the lib, res, assets and other directories. The files to be compressed can be determined from the above files to be packaged.
[0101] In specific implementation, this embodiment provides two implementation methods for determining the files to be compressed from the files to be packaged. One is to obtain the predefined files to be compressed in the files to be packaged. That is, the user can predefine the files to be compressed, and then determine whether the files to be packaged include the predefined files to be compressed. If so, obtain the files to be compressed. For example, the predefined files to be compressed are files with extensions of .dex and .arsc. If the files to be packaged include .dex and .arsc files, obtain the .dex and .arsc files and use them as the files to be compressed.
[0102] Another method is to obtain the file size of each to-be-packaged file, and determine the to-be-packaged files that exceed the threshold as to-be-compressed files, that is, determine the larger files among the to-be-packaged files as to-be-compressed files, wherein the larger files can be obtained by threshold screening.
[0103] It should be noted that, in actual applications, one of the methods can be selected to determine the files to be compressed, or both methods can be used at the same time. The specific selection method can be determined according to the actual application situation, and this embodiment does not limit it here.
[0104] In actual application, since the dex file (i.e., an Android executable file) in the APK file cannot be directly obtained, this embodiment also provides two ways to generate dex files and determine the dex files as files to be packaged. In these two implementation methods, one is to precompile the class file to generate an Android executable file, and determine the Android executable file as a file to be packaged; the other is to decompress the second program installation file to obtain the Android executable file, and determine the Android executable file as a file to be packaged. That is, the class file (i.e., class file) that has not yet been compiled can be precompiled to obtain an Android executable file, and the Android executable file is determined as a file to be packaged. Alternatively, for the second program installation file that has been generated in a traditional manner, first decompress it to obtain an Android executable file, determine the Android executable file as a file to be packaged, and then perform subsequent processing according to the method for generating the program installation file provided in this application.
[0105] S202: Performing a first compression operation on the file to be compressed using a preset compression method to generate a compressed file.
[0106] After the file to be compressed is determined, a first compression operation can be performed on the file to be compressed using a preset compression method to obtain a compressed file. That is, the file to be compressed is compressed to reduce the size of the compressed file. The preset compression method can be a compression method with a high compression ratio, such as LZMA (Lempel-Ziv-Markov chain-Algorithm), and the generated compressed file is a .lzma type file.
[0107] S203: Convert the compressed file into a first dynamic library file.
[0108] After the compressed file is obtained, it is converted into a first dynamic library file. The first dynamic library file is a file of dynamic library type, which is converted from the compressed file to facilitate subsequent other operations on the first dynamic library file.
[0109] In the specific implementation process, different conversion methods are used when converting compressed files generated for different types of files to be compressed. When the file to be compressed is a file of a dynamic library type, after a first compression operation is performed on the file to be compressed using a preset compression method to generate a compressed file, when the compressed file is converted to a first dynamic library file, the last level extension of the compressed file can be deleted to obtain a first dynamic library file. When the file to be compressed is a file of a non-dynamic library type, after a first compression operation is performed on the file to be compressed using a preset compression method to generate a compressed file, when the compressed file is converted to a first dynamic library file, the last level extension of the compressed file can be replaced with an extension of the dynamic library type to obtain a first dynamic library file. Among them, the last level extension of the compressed file is the extension of the compression algorithm.
[0110] For example, in the Android platform, the extension corresponding to the file of the dynamic library type can be .so. When the file to be compressed is a dynamic library type file such as libcore.so, it is compressed using the LZMA compression method to generate a compressed file libcore.so.lzma, and the last level extension is deleted to obtain the first dynamic library file libcore.so. When the file to be compressed is a classes.dex file, the classes.dex file is compressed using LZMA, and the generated compressed file is classes.dex.lzma, and the last level extension is replaced with .so to obtain the first dynamic library file classes.dex.so.
[0111] It is understandable that when the file to be compressed is a file of the dynamic library type, the file name of the file to be compressed is the same as the file name of the first dynamic library file corresponding to it; when the file to be compressed is a file of a non-dynamic library type, the first dynamic library file corresponding to it cannot reflect its own file type. To facilitate the subsequent installation of files, when converting the compressed file to the first dynamic library file, the original file type corresponding to each first dynamic library file can also be pre-stored, so that after the subsequent decompression is completed, the file type can be restored to the original file type by referring to the pre-stored information.
[0112] S204: Packing the non-to-be-compressed files and the first dynamic library file in the files to be packaged to generate a first program installation file.
[0113] After obtaining the first dynamic library file, the non-to-be-compressed files in the to-be-packaged files and the first dynamic library file are packaged to obtain a first program installation file.
[0114] In specific implementation, this embodiment provides an implementation method for packaging a file to be compressed and a first dynamic library file, specifically, performing a second compression operation on the second dynamic library file and the first dynamic library file in the non-to-be-compressed file in the to-be-packaged file to generate a third dynamic library file; and then performing a packaging operation on other non-to-be-compressed files and the third dynamic library file to generate a first program installation file. That is, if the second dynamic library file is a file of the dynamic library type in the non-to-be-compressed file in the to-be-packaged file, then firstly filter out a file of the dynamic library type (i.e., the second dynamic library file) from the non-to-be-compressed file in the to-be-packaged file, and then perform a second compression operation on the second dynamic library file and the first dynamic library file obtained by the first compression operation to obtain the third dynamic library file, thereby achieving further compression to reduce the size of the packaged program installation file.
[0115] It can be known from the above description that, in the embodiment of the present application, before packaging and generating a program installation file, the to-be-compressed files in the to-be-packaged files are first determined, and the to-be-compressed files are subjected to a first compression operation using a preset compression method to generate a compressed file, and then the compressed file is converted into a first dynamic library file. Finally, the non-to-be-compressed files and the first dynamic library file in the to-be-packaged files are packaged to generate a first program installation file. That is, for the larger files in the to-be-packaged files, i.e., the to-be-compressed files, a compression algorithm with a high compression ratio can be used to perform a first compression operation, thereby significantly reducing the to-be-compressed files, and then reducing the first program installation file after packaging. When the user needs to install the application corresponding to the first program installation file, the first program installation file can be directly downloaded. Since the first program installation file is relatively small, network resources can be saved, and the installation speed and user experience can be improved.
[0116] To understand the method for generating the program installation file provided by this application, see Figure 3 The generation framework diagram shown in the figure first obtains the file to be packaged, and determines the file to be compressed therefrom. Performs a first compression operation on the file to be compressed to obtain a compressed file, and then converts the compressed file into a first dynamic library file. Then, performs a second compression operation on the second dynamic library file and the first dynamic library file in the file to be packaged to obtain a third dynamic library file. Finally, performs a packaging operation on the third dynamic library file and the file not to be compressed to obtain a first program installation file.
[0117] When the user wants to install the application corresponding to the first program installation file, the user can download the first program installation file from the server through the terminal, and obtain an installable program file after processing the first program file. The specific processing process will be described in conjunction with the accompanying drawings.
[0118] See also Figure 4 , which is a flowchart of a method for processing program installation files provided by an embodiment of the present application, such as Figure 4 As shown, the method may include:
[0119] S401: Unpacking the program installation file to obtain a first dynamic library file.
[0120] Since the program installation file stored in the server is a packaged file, that is, the first program installation file, when the terminal obtains the program installation file, it needs to unpack the program installation file to obtain the first dynamic library file.
[0121] In a specific implementation, when the program installation file obtained by the terminal is a file generated by two compression operations, the unpacking operation on the program installation file to obtain the first dynamic library file includes: unpacking the program installation file to obtain a third dynamic library file; and determining the first dynamic library file from the third dynamic library file. Determining the first dynamic library file from the third dynamic library file may be performing a second decompression operation on the third dynamic library file, and identifying the first dynamic library file from a file of a dynamic library type obtained by the second decompression operation.
[0122] It is understandable that, since the third dynamic library file includes both the first dynamic library file obtained by the first compression operation and the file itself of the dynamic library type. Therefore, it is necessary to identify the first dynamic library file from the file of the dynamic library type obtained by the second decompression operation. In a specific implementation, which files of the dynamic library type are the first dynamic library file can be identified according to a pre-stored configuration file. The configuration file can be generated when the second compression operation is performed to record which files of the dynamic library type in the files subjected to the second compression operation are the first dynamic library files.
[0123] S402: Performing a first decompression operation on the first dynamic library file using a preset decompression method.
[0124] It is understandable that, since the first dynamic library file is obtained by performing the first compression operation using the preset compression method when generating the first dynamic library file, it is necessary to perform the first decompression operation on the first dynamic library file using the corresponding decompression method to obtain the decompressed file. For example, when the program installation file is generated, the LZMA compression method is used for the first compression operation, and when decompressing, the LZMA decompression method is used for the compression operation on the first dynamic library file.
[0125] In specific implementation, this embodiment provides a method for performing a first decompression operation on a first dynamic library file using a preset decompression method, specifically, identifying the original file type corresponding to the first dynamic library file; when the original file type corresponding to the first dynamic library file is identified as a dynamic library type, directly performing a first decompression operation on the first dynamic library file using a preset decompression method to obtain a file of the dynamic library type; when the original file type corresponding to the first dynamic library file is identified as a non-dynamic library type, performing a first decompression operation on the first dynamic library file using a preset decompression method, deleting the last level extension of the file of the dynamic library type obtained by the first decompression operation, and obtaining a file of the original file type.
[0126] It is understandable that through Figure 3 It can be seen from the embodiment that when converting a compressed file into a first dynamic library file, the converted compressed file can be obtained by compressing a file of a dynamic library type or a file of a non-dynamic library type, and no matter which type of file it is, it is converted into a file of a dynamic library type. Therefore, when decompressing the first dynamic library file, it is also necessary to identify the original file type corresponding to the first dynamic library file, that is, whether it is a dynamic library type or a non-dynamic library type. Among them, the specific implementation of identifying the original file type corresponding to the first dynamic library file will be described in subsequent embodiments.
[0127] If the original file type corresponding to the first dynamic library file is a dynamic library type, the first dynamic library file is directly decompressed to obtain a file of the dynamic library type. For example, if the first dynamic library file is libcore.so, and the original file type corresponding to it is a dynamic library type, libcore.so is directly decompressed to obtain a file of the dynamic library type libcore.so. If the original file type corresponding to the first dynamic library file is a non-dynamic library type, the first dynamic library file is first decompressed to obtain a file of the dynamic library type, and then the last level extension of the file of the dynamic library type is deleted to obtain a file of the original file type. For example, if the first dynamic library file is classes.dex.so, and the original file type corresponding to it is a non-dynamic library type, classes.dex.so is first decompressed to obtain a file of the dynamic library type classes.dex.so, and the last level extension of the file is deleted to obtain a file of the original file type classes.dex.
[0128] In the specific implementation, when the original file type corresponding to the first dynamic library file is a dynamic library type, it is directly decompressed, and the decompressed file can be stored in the directory where the first dynamic library file is located; when the original file type corresponding to the first dynamic library file is a non-dynamic library type, the decompressed file can be stored in a preset directory, so that when the application is started, the required file can be read in the preset directory.
[0129] In a possible implementation, this embodiment provides the following implementable methods for identifying the original file type corresponding to the first dynamic library file, specifically:
[0130] One is to query the corresponding original file type according to the file name corresponding to the first dynamic library file.
[0131] That is, when converting a compressed file into a first dynamic library file, the mapping relationship between the file name corresponding to the first dynamic library file and the original file type corresponding to the first dynamic library file is recorded. When it is necessary to obtain the original file type corresponding to the first dynamic library file, the corresponding original file type can be queried according to the file name corresponding to the first dynamic library file.
[0132] Another method is to identify the file type flag in the first dynamic library file and determine the original file type corresponding to the first dynamic library file.
[0133] That is, the original file type corresponding to the first dynamic library file is characterized by the file type flag in the first dynamic library file, and when it is necessary to obtain the original file type corresponding to the first dynamic library file, the original file type can be known by identifying the flag. For example, if the file type flag is 1, it means that the original file type of the first dynamic library file is a dynamic library type, and if the flag is 0, it means that the original file type of the first dynamic library file is a non-dynamic type, and the original file type of the first dynamic library file can be determined by identifying the flag.
[0134] Another method is to identify the original file type corresponding to the first dynamic library file as the dynamic library type when the first dynamic library file includes only an extension of the dynamic library type and an extension of the non-dynamic library type; and to identify the original file type corresponding to the first dynamic library file according to the included extension of the non-dynamic library type.
[0135] It is understandable that, when converting the compressed file to the first dynamic library file, if the compressed file itself is a file of the dynamic library type, it is only necessary to delete the last level extension of the compressed file (the extension corresponding to the compression method) during the conversion, and retain the extension of the dynamic library type. If the compressed file itself is a file of the non-dynamic library type, it is only necessary to replace the last level extension of the compressed file (the extension corresponding to the compression method) with the extension of the dynamic library type during the conversion, and retain the extension of the non-dynamic library type. That is, the extension of the original file type is retained regardless of the conversion, and therefore, the original file type corresponding to the first dynamic library file can be identified by judging the extension included in the first dynamic library file.
[0136] When the first dynamic library file only includes the extension of the dynamic library type, it indicates that the corresponding original file type is the dynamic library type. For example, the first dynamic library file is libcore.so, which only includes the extension of the dynamic library type.so, then the original file type corresponding to the first dynamic library file is the dynamic library type; when the first dynamic library file includes both the extension of the dynamic library type and the extension of the non-dynamic library type, it indicates that the corresponding original file type is the non-dynamic library type. For example, the first dynamic library file is classe.dex.so, which includes the extension of the dynamic library type.so, and also includes the extension of the non-dynamic library type.dex, then the original file type corresponding to the first dynamic library file is the non-dynamic library type.
[0137] For easier understanding, see Figure 5 As shown in the processing framework diagram, the obtained program installation file is first unpacked to obtain the third dynamic library file and other files. Then the third dynamic library file is subjected to a second decompression operation to obtain the first dynamic library file and the second dynamic library file. Finally, the first dynamic library file is subjected to a first compression operation to obtain a dynamic library type file and a non-dynamic library type file.
[0138] It can be seen from the above embodiment that when the application is started by the terminal, the program installation file is decompressed to support the application. In addition, since the program installation file downloaded by the terminal is a smaller file, network resources can be saved, and the installation speed and user experience can be improved.
[0139] Based on the above method embodiment, the present application provides a device for generating and processing a program installation file, which will be described below in conjunction with the accompanying drawings.
[0140] See also Figure 6 , a structure diagram of a device for generating program installation files, such as Figure 6 As shown, the device comprises:
[0141] A determination unit 601 is used to determine a file to be compressed in a file to be packaged;
[0142] The first generating unit 602 is used to perform a first compression operation on the file to be compressed using a preset compression method to generate a compressed file;
[0143] A conversion unit 603, used for converting the compressed file into a first dynamic library file;
[0144] The second generating unit 604 is used to perform a packaging operation on the non-to-be-compressed files in the to-be-packaged files and the first dynamic library file to generate a first program installation file.
[0145] In a possible implementation, the determining unit is specifically configured to obtain predefined to-be-compressed files from the to-be-packaged files; and / or obtain the file size of each to-be-packaged file, and determine the to-be-packaged files whose file size exceeds a threshold as to-be-compressed files.
[0146] In a possible implementation manner, the device further includes:
[0147] A third generating unit is used for compiling the class file into an Android executable file before executing the determining unit, and determining the Android executable file as a file to be packaged, or
[0148] The acquisition unit is used to decompress the second program installation file to obtain an Android executable file, and determine the Android executable file as a file to be packaged.
[0149] In a possible implementation, when the file to be compressed is a file of a dynamic library type, the conversion unit is specifically used to delete the last level extension of the compressed file to obtain a first dynamic library file;
[0150] When the file to be compressed is a file of a non-dynamic library type, the conversion unit is specifically configured to replace the last level extension of the compressed file with an extension of a dynamic library type to obtain a first dynamic library file.
[0151] In a possible implementation, the second generating unit specifically includes:
[0152] A first generating sub-unit is used for performing a second compression operation on the second dynamic library file in the non-to-be-compressed file in the to-be-packaged file and the first dynamic library file to generate a third dynamic library file;
[0153] The second generating sub-unit is used to package other non-to-be-compressed files and the third dynamic library file to generate a first program installation file.
[0154] It should be noted that the implementation of each unit in this embodiment can refer to the above method embodiment, and this embodiment is not limited here.
[0155] See also Figure 7 , which is a result diagram of a processing device for a program installation file provided in an embodiment of the present application, such as Figure 7 As shown, the device comprises:
[0156] The unpacking unit 701 is used to unpack the program installation file to obtain a first dynamic library file;
[0157] The decompression unit 702 is used to perform a first decompression operation on the first dynamic library file using a preset decompression method.
[0158] In a possible implementation, the unpacking unit includes:
[0159] The unpacking subunit is used to unpack the program installation file to obtain a third dynamic library file;
[0160] The determination subunit is used to determine the first dynamic library file from the third dynamic library file.
[0161] In a possible implementation, the determining subunit is specifically configured to perform a second decompression operation on the third dynamic library file, and identify the first dynamic library file from a file of a dynamic library type obtained by the second decompression operation.
[0162] In a possible implementation, the decompression unit includes:
[0163] An identification subunit, used to identify the original file type corresponding to the first dynamic library file;
[0164] A first decompression subunit is used for, when recognizing that the original file type corresponding to the first dynamic library file is a dynamic library type, directly performing a first decompression operation on the first dynamic library file in a preset decompression manner to obtain a file of the dynamic library type;
[0165] The second decompression sub-unit is used to, when recognizing that the original file type corresponding to the first dynamic library file is a non-dynamic library type, perform a first decompression operation on the first dynamic library file using a preset decompression method, delete the last level extension of the dynamic library type file obtained by the first decompression operation, and obtain a file of the original file type.
[0166] In a possible implementation, the identification subunit is specifically used to query the corresponding original file type according to the file name corresponding to the first dynamic library file; or, identify the file type flag in the first dynamic library file to determine the original file type corresponding to the first dynamic library file; or, when the first dynamic library file only includes an extension of the dynamic library type, identify the original file type corresponding to the first dynamic library file as the dynamic library type; when the first dynamic library file includes an extension of the dynamic library type and an extension of a non-dynamic library type, identify the original file type corresponding to the first dynamic library file according to the included extension of the non-dynamic library type.
[0167] It should be noted that the implementation of each unit in this embodiment can refer to the above method embodiment, and this embodiment is not limited here.
[0168] Figure 8 800 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 822 (e.g., one or more processors) and memory 832, and one or more storage media 830 (e.g., one or more mass storage devices) storing application programs 842 or data 844. Among them, the memory 832 and the storage medium 830 may be short-term storage or permanent storage. The program stored in the storage medium 830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 822 may be configured to communicate with the storage medium 830 to execute a series of instruction operations in the storage medium 830 on the server 800.
[0169] The server 800 may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input and output interfaces 856, one or more keyboards 856, and / or one or more operating systems 841, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0170] In a specific implementation, the CPU 822 may execute the following instructions:
[0171] Determine the files to be compressed in the files to be packaged;
[0172] Performing a first compression operation on the file to be compressed using a preset compression method to generate a compressed file;
[0173] Converting the compressed file into a first dynamic library file;
[0174] The non-to-be-compressed files in the to-be-packaged files and the first dynamic library file are packaged to generate a first program installation file.
[0175] Optionally, determining the files to be compressed in the files to be packaged includes:
[0176] Obtain a predefined file to be compressed in the file to be packaged; and / or,
[0177] The file size of each to-be-packaged file is obtained, and the to-be-packaged files whose file sizes exceed a threshold are determined as to-be-compressed files.
[0178] Optionally, before determining the files to be compressed in the files to be packaged, the method further includes:
[0179] Compile the class file to generate an Android executable file, and determine the Android executable file as a file to be packaged, or decompress the second program installation file to obtain the Android executable file, and determine the Android executable file as a file to be packaged.
[0180] Optionally, when the file to be compressed is a file of a dynamic library type, converting the compressed file into a first dynamic library file includes:
[0181] Deleting the last level extension of the compressed file to obtain a first dynamic library file;
[0182] When the to-be-compressed file is a file of a non-dynamic library type, converting the compressed file into a first dynamic library file comprises:
[0183] The last level extension of the compressed file is replaced with an extension of the dynamic library type to obtain a first dynamic library file.
[0184] Optionally, the step of packaging the non-to-be-compressed files in the to-be-packaged files and the first dynamic library file to generate a first program installation file includes:
[0185] Perform a second compression operation on the second dynamic library file in the non-to-be-compressed file in the to-be-packaged file and the first dynamic library file to generate a third dynamic library file;
[0186] The other non-to-be-compressed files and the third dynamic library file are packaged to generate a first program installation file.
[0187] Fig. 9A block diagram of a program installation file processing device 900 is shown. For example, the device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0188] Reference Fig. 9 , the device 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 909 , a multimedia component 908 , an audio component 910 , an input / output (I / O) interface 99 , a sensor component 914 , and a communication component 916 .
[0189] The processing component 902 generally controls the overall operation of the device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 909 and the processing component 902.
[0190] The memory 904 is configured to store various types of data to support operations on the device 900. Examples of such data include instructions for any application or method operating on the device 900, contact data, phone book data, messages, pictures, videos, etc. The memory 904 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0191] The power component 909 provides power to the various components of the device 900. The power component 909 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 900.
[0192] The multimedia component 908 includes a screen that provides an output interface between the device 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 908 includes a front camera and / or a rear camera. When the device 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0193] The audio component 910 is configured to output and / or input audio signals. For example, the audio component 910 includes a microphone (MIC), and when the device 900 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 904 or sent via the communication component 916. In some embodiments, the audio component 910 also includes a speaker for outputting audio signals.
[0194] The I / O interface provides an interface between the processing component 902 and the peripheral interface module, which may be a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0195] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the device 900. For example, the sensor assembly 914 can detect the open / closed state of the device 900, the relative positioning of components, such as the display and keypad of the device 900, and the sensor assembly 914 can also detect the position change of the device 900 or a component of the device 900, the presence or absence of user contact with the device 900, the orientation or acceleration / deceleration of the device 900, and the temperature change of the device 900. The sensor assembly 914 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0196] The communication component 916 is configured to facilitate wired or wireless communication between the device 900 and other devices. The device 900 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 916 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 916 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0197] In an exemplary embodiment, the apparatus 900 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the following methods:
[0198] Unpacking the program installation file to obtain a first dynamic library file;
[0199] The first dynamic library file is subjected to a first decompression operation using a preset decompression method.
[0200] Optionally, the unpacking operation on the program installation file to obtain the first dynamic library file includes:
[0201] Unpacking the program installation file to obtain a third dynamic library file;
[0202] A first dynamic library file is determined from the third dynamic library file.
[0203] Optionally, determining the first dynamic library file from the third dynamic library file includes:
[0204] The third dynamic library file is subjected to a second decompression operation, and the first dynamic library file is identified from the files of the dynamic library type obtained by the second decompression operation.
[0205] Optionally, performing a first decompression operation on the first dynamic library file in a preset decompression manner includes:
[0206] Identify the original file type corresponding to the first dynamic library file;
[0207] When it is identified that the original file type corresponding to the first dynamic library file is a dynamic library type, directly performing a first decompression operation on the first dynamic library file in a preset decompression manner to obtain a file of the dynamic library type;
[0208] When it is identified that the original file type corresponding to the first dynamic library file is a non-dynamic library type, the first dynamic library file is subjected to a first decompression operation using a preset decompression method, and the last level extension of the dynamic library type file obtained by the first decompression operation is deleted to obtain a file of the original file type.
[0209] Optionally, the identifying the original file type corresponding to the first dynamic library file includes:
[0210] Query the corresponding original file type according to the file name corresponding to the first dynamic library file;
[0211] or,
[0212] Identify the file type flag in the first dynamic library file, and determine the original file type corresponding to the first dynamic library file;
[0213] or,
[0214] When the first dynamic library file only includes an extension of the dynamic library type, the original file type corresponding to the first dynamic library file is identified as the dynamic library type; when the first dynamic library file includes an extension of the dynamic library type and an extension of the non-dynamic library type, the original file type corresponding to the first dynamic library file is identified based on the included extension of the non-dynamic library type.
[0215] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0216] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0217] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0218] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0219] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating a program installation file, It is characterized in that The method comprises: Determine the files to be compressed in the files to be packaged; the types of the files to be compressed include dynamic library types and non-dynamic library types; Performing a first compression operation on the file to be compressed using a preset compression method to generate a compressed file; When the file to be compressed is a file of a dynamic library type, the last level extension of the compressed file is deleted to obtain a first dynamic library file; When the file to be compressed is a file of a non-dynamic library type, replacing the last level extension of the compressed file with an extension of a dynamic library type to obtain a first dynamic library file; Storing the original file type corresponding to the first dynamic library file, including: recording a mapping relationship between the file name corresponding to the first dynamic library file and the original file type corresponding to the first dynamic library file; or, characterizing the original file type corresponding to the first dynamic library file by a file type flag in the first dynamic library file; or, characterizing the original file type corresponding to the first dynamic library file by an extension included in the first dynamic library file, wherein, when the first dynamic library file only includes an extension of a dynamic library type, the original file type corresponding to the first dynamic library file is characterized as a dynamic library type, and when the first dynamic library file includes an extension of a dynamic library type and an extension of a non-dynamic library type, the included extension of the non-dynamic library type is used to characterize the original file type corresponding to the first dynamic library file; Perform a second compression operation on the second dynamic library file in the non-compressed file in the to-be-packaged file and the first dynamic library file to generate a third dynamic library file, and record the first dynamic library file in the file of the dynamic library type that performs the second compression operation in a pre-stored configuration file; The other non-to-be-compressed files and the third dynamic library file are packaged to generate a first program installation file.
2. The method according to claim 1, It is characterized in that The step of determining the files to be compressed in the files to be packaged includes: Obtain a predefined file to be compressed in the file to be packaged; and / or, The file size of each to-be-packaged file is obtained, and the to-be-packaged files whose file sizes exceed a threshold are determined as to-be-compressed files.
3. The method according to claim 1, It is characterized in that Before determining the files to be compressed in the files to be packaged, the method further includes: Compile the class file to generate an Android executable file, and determine the Android executable file as a file to be packaged, or decompress the second program installation file to obtain the Android executable file, and determine the Android executable file as a file to be packaged.
4. A method for processing program installation files, It is characterized in that The method comprises: Unpacking the program installation file to obtain a third dynamic library file; the third dynamic library file is generated by performing a second compression operation on the second dynamic library file in the non-compressed file to be packaged and the first dynamic library file; The third dynamic library file is subjected to a second decompression operation, and a first dynamic library file is identified from the files of the dynamic library type obtained by the second decompression operation according to a pre-stored configuration file; the first dynamic library file is obtained by converting a compressed file; the compressed file is generated by performing a first compression operation on the files to be compressed in the files to be packaged using a preset compression method; the files to be compressed include files of the dynamic library type and files of the non-dynamic library type; the configuration file is used to record the first dynamic library file in the files of the dynamic library type subjected to the second compression operation; Identifying the original file type corresponding to the first dynamic library file, comprising: querying the corresponding original file type according to the file name corresponding to the first dynamic library file; or identifying the file type flag bit in the first dynamic library file to determine the original file type corresponding to the first dynamic library file; or, when the first dynamic library file only includes an extension of the dynamic library type, identifying the original file type corresponding to the first dynamic library file as the dynamic library type; when the first dynamic library file includes an extension of the dynamic library type and an extension of a non-dynamic library type, identifying the original file type corresponding to the first dynamic library file according to the included extension of the non-dynamic library type; When it is identified that the original file type corresponding to the first dynamic library file is a dynamic library type, directly performing a first decompression operation on the first dynamic library file in a preset decompression manner to obtain a file of the dynamic library type; When it is identified that the original file type corresponding to the first dynamic library file is a non-dynamic library type, the first dynamic library file is subjected to a first decompression operation using a preset decompression method, and the last level extension of the dynamic library type file obtained by the first decompression operation is deleted to obtain a file of the original file type.
5. A device for generating a program installation file, It is characterized in that The device comprises: A determination unit, used for determining the files to be compressed in the files to be packaged; A first generating unit, configured to perform a first compression operation on the file to be compressed using a preset compression method to generate a compressed file; A conversion unit, used for deleting the last level extension of the compressed file to obtain a first dynamic library file when the file to be compressed is a file of a dynamic library type; when the file to be compressed is a file of a non-dynamic library type, replacing the last level extension of the compressed file with an extension of a dynamic library type to obtain a first dynamic library file; and storing the original file type corresponding to the first dynamic library file, including: recording a mapping relationship between the file name corresponding to the first dynamic library file and the original file type corresponding to the first dynamic library file; or, characterizing the original file type corresponding to the first dynamic library file by a file type flag in the first dynamic library file; or, characterizing the original file type corresponding to the first dynamic library file by an extension included in the first dynamic library file, wherein, when the first dynamic library file only includes an extension of a dynamic library type, the original file type corresponding to the first dynamic library file is characterized as a dynamic library type, and when the first dynamic library file includes an extension of a dynamic library type and an extension of a non-dynamic library type, the included extension of the non-dynamic library type is used to characterize the original file type corresponding to the first dynamic library file; A first generating subunit is used for performing a second compression operation on the second dynamic library file that is not a file to be compressed in the to-be-packaged file and the first dynamic library file to generate a third dynamic library file, and recording the first dynamic library file in the file of the dynamic library type that performs the second compression operation in a pre-stored configuration file; The second generating sub-unit is used to package other non-to-be-compressed files and the third dynamic library file to generate a first program installation file.
6. The device according to claim 5, It is characterized in that The determining unit is specifically configured to obtain a predefined to-be-compressed file from the to-be-packaged files; and / or to obtain a file size of each to-be-packaged file, and to determine a to-be-packaged file whose file size exceeds a threshold as a to-be-compressed file.
7. The device according to claim 5, It is characterized in that The device also includes: A third generating unit is used for compiling the class file into an Android executable file before executing the determining unit, and determining the Android executable file as a file to be packaged, or The acquisition unit is used to decompress the second program installation file to obtain an Android executable file, and determine the Android executable file as a file to be packaged.
8. A device for processing program installation files, It is characterized in that The device comprises: An unpacking subunit is used to unpack the program installation file to obtain a third dynamic library file; the third dynamic library file is generated by performing a second compression operation on the second dynamic library file in the file to be packaged and the first dynamic library file that is not in the file to be compressed; A determination subunit is used to perform a second decompression operation on the third dynamic library file, and identify a first dynamic library file from the files of the dynamic library type obtained by the second decompression operation according to a pre-stored configuration file; the first dynamic library file is obtained by converting a compressed file; the compressed file is obtained by performing a first compression operation on the file to be compressed using a preset compression method; the file to be compressed includes a file of the dynamic library type and a file of the non-dynamic library type; the configuration file is used to record the first dynamic library file in the file of the dynamic library type that performs the second compression operation; an identification subunit, for identifying the original file type corresponding to the first dynamic library file, comprising: querying the corresponding original file type according to the file name corresponding to the first dynamic library file; or identifying the file type flag bit in the first dynamic library file to determine the original file type corresponding to the first dynamic library file; or, when the first dynamic library file only includes an extension of the dynamic library type, identifying the original file type corresponding to the first dynamic library file as the dynamic library type; when the first dynamic library file includes an extension of the dynamic library type and an extension of a non-dynamic library type, identifying the original file type corresponding to the first dynamic library file according to the included extension of the non-dynamic library type; A first decompression subunit is used for, when recognizing that the original file type corresponding to the first dynamic library file is a dynamic library type, directly performing a first decompression operation on the first dynamic library file in a preset decompression manner to obtain a file of the dynamic library type; The second decompression sub-unit is used to, when recognizing that the original file type corresponding to the first dynamic library file is a non-dynamic library type, perform a first decompression operation on the first dynamic library file using a preset decompression method, delete the last level extension of the dynamic library type file obtained by the first decompression operation, and obtain a file of the original file type.
9. A device for generating program installation files, It is characterized in that The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include a method for generating a program installation file according to any one of claims 1 to 3.
10. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, causes a device to execute the method for generating a program installation file according to any one of claims 1 to 3.
11. A processing device for program installation files, It is characterized in that The device comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include a method for processing a program installation file as claimed in claim 4 .
12. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, causes a device to execute the method for processing program installation files according to claim 4.
Citation Information
Patent Citations
Generation method for application installation file and starting method and device for application
CN103955375A
Method and device for automatically generating software installation package
CN104714788A
Method and device for extending Android software function
CN104866294A
Android installation package compression method and device
CN106325834A