File processing method and apparatus

By performing class reference deduplication on the target files of the Android application package (APK) and optimizing the debug project files, the problem of excessive APK size was solved, and memory optimization and application efficiency were improved.

CN116226060BActive Publication Date: 2026-05-26SHANGHAI BILIBILI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI BILIBILI TECH CO LTD
Filing Date
2023-03-14
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies cannot effectively optimize the size of Android application packages (APKs), resulting in a large amount of memory occupied on the client, which affects application running efficiency and download volume.

Method used

By obtaining the target files from the installation package source files, deleting some files containing referenced target classes and methods of referenced target classes according to preset compilation rules, performing class reference deduplication, optimizing the mapping table and debug project files, and generating the installation package file.

Benefits of technology

It effectively reduces APK size, decreases client memory usage, and improves application running efficiency and download volume.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226060B_ABST
    Figure CN116226060B_ABST
Patent Text Reader

Abstract

This application provides a file processing method, comprising: obtaining target files from an installation package source file, wherein the target files are multiple; compiling the target files according to a preset compilation rule to obtain an installation package file, wherein the compilation rule at least includes determining a first file and a second file among the target files, and deleting at least a portion of the first file and / or the second file, wherein the first file is a file of a referenced target class, and the second file is a file of a method of the referenced target class. The file processing method provided by this application can effectively optimize the size of an APK.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a file processing method, apparatus, computer equipment, and storage medium. Background Technology

[0002] An Android application package (APK) is an application package file format used by the Android operating system for distributing and installing mobile applications and middleware. For an Android application's code to run on an Android device, it must first be compiled and then packaged into a file that the Android system can recognize and run. This file format that the Android system can recognize and run is called an "APK".

[0003] To increase APK download volume and reduce the memory space occupied by APK on the client, compression algorithms are usually used to compress APKs, thereby reducing their size. However, this compression method has limited effect and cannot effectively optimize the size of APKs. Summary of the Invention

[0004] The purpose of this application is to provide a file processing method, apparatus, computer device, and storage medium to solve the technical problem that it is currently impossible to effectively optimize the size of APKs.

[0005] One aspect of this application provides a file processing method, including: obtaining target files in an installation package source file, wherein there are several target files; compiling the target files according to a preset compilation rule to obtain an installation package file, wherein the compilation rule includes at least determining a first file and a second file between the target files, and deleting at least a portion of the first file and / or the second file, wherein the first file is a file of a referenced target class, and the second file is a file of a method of the referenced target class.

[0006] Optionally, identifying the first and second files among the target files and deleting at least a portion of the first and / or second files includes: obtaining the first and second files in all target files; if the first and second files are contained in all target files, identifying the first and second files as duplicate class reference files and deleting at least one second file.

[0007] Optionally, identifying the first and second files between the target files and deleting at least a portion of the first and / or second files includes: obtaining the first and second files in every pair of target files across all target files; and, if any two target files contain the first and second files, identifying the first and second files as duplicate class reference files and deleting the second file.

[0008] Optionally, the method further includes: obtaining information from the retained first or second file as first information; and modifying the mapping table, mapping offset, and reference address in the target file according to the first information.

[0009] Optionally, the target file is a dex file.

[0010] Optionally, compiling the target files according to preset compilation rules also includes: obtaining a line number relationship table in all target files; generating a global debug project file based on the line number relationship table and storing the global debug project file to the local disk; and deleting the debug project file in each target file.

[0011] Optionally, after deleting the debug project file in each first target file, the method further includes: obtaining information about the global debug project file as second information; establishing a correspondence between each target file and the global debug project file; and adjusting the anti-location rules for the problem line numbers in each target file based on the correspondence and the second information.

[0012] One aspect of this application provides a file processing apparatus, including: an acquisition module for acquiring target files in an installation package source file, wherein the target files are a plurality of targets; and a compilation module for compiling the target files according to preset compilation rules to obtain an installation package file, wherein the compilation rules at least include determining a first file and a second file between the target files, and deleting at least a portion of the first file and / or the second file, wherein the first file is a file of a referenced target class, and the second file is a file of a method of the referenced target class.

[0013] One aspect of this application provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the above-described file processing method.

[0014] One aspect of this application provides a computer-readable storage medium storing a computer program that can be executed by at least one processor to perform the steps of the above-described file processing method.

[0015] The document processing method, apparatus, computer equipment, and storage medium provided in this application have the following advantages:

[0016] By obtaining the target files from the installation package source file and compiling them according to preset compilation rules, the installation package file is obtained. Since the preset compilation rules include deleting files that at least partially reference the target class and / or methods of the target class, the size of the installation package (APK) can be reduced, thereby effectively optimizing the APK size. At the same time, the reduction in the size of the installation package can reduce the memory space occupied by the client, improve the running efficiency of the app and the resource utilization of the client device, and also help increase the number of app downloads. Attached Figure Description

[0017] Figure 1 Example image showing the generation of dex files in the Android system;

[0018] Figure 2 This is a diagram illustrating the composition of a dex file;

[0019] Figure 3 A flowchart illustrating the document processing method of Embodiment 1 of this application is shown schematically.

[0020] Figure 4 for Figure 3 A flowchart of the sub-steps of step S120;

[0021] Figure 5 for Figure 3 A flowchart of another sub-step in step S120;

[0022] Figure 6 for Figure 4 or Figure 5 The flowchart for the newly added steps;

[0023] Figure 7 This is an example diagram for deduplicating class references in a target file;

[0024] Figure 8 for Figure 3 A flowchart of another sub-step in step S120;

[0025] Figure 9 for Figure 8 Flowchart of the new step;

[0026] Figure 10 A block diagram of a document processing apparatus according to Embodiment 2 of this application is shown schematically;

[0027] Figure 11 The schematic diagram illustrates the hardware architecture of the computer device according to Embodiment 3 of this application. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0029] It should be noted that the descriptions involving "first," "second," etc., in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0030] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order of the steps, but are only used to facilitate the description of this application and to distinguish each step, and therefore should not be construed as a limitation of this application.

[0031] The following is an explanation of the terms used in this application:

[0032] Debugging is the process of finding and reducing errors in computer programs or electronic devices.

[0033] In object-oriented programming, a class is a construct in an object-oriented computer programming language. It is a blueprint for creating objects and describes the common characteristics and methods of the created objects.

[0034] Please refer to Figure 1 This is an example diagram illustrating the generation of dex files in the Android system. As shown, class files are packaged into dex files using Google's subpackaging technology in Android. When multiple class files are packaged into the same dex file, Android removes duplicate references to ensure that a single dex file does not contain duplicate file information. However, the content between multiple dex files is not deduplicated. Aside from these differences and structural variations, the content of dex files and class files is almost identical.

[0035] Please refer to Figure 2This is a schematic diagram illustrating the composition of a dex file. As shown, a dex file is divided into a header section, other basic data tables, a class-related information mapping table, and a data section. The data section can include modules such as code modules and debug information comparison modules.

[0036] The file processing method provided in this application can effectively optimize the size of the APK by deduplicating class references between dex files.

[0037] It should be noted that the execution subject of the file processing method provided in this application embodiment can be a client or a server. Specifically, the client can be, but is not limited to, various personal computers, laptops, smartphones, tablets and portable wearable devices, and the server can be implemented using an independent server or a server cluster composed of multiple servers.

[0038] The following will describe the file processing scheme of this application through several embodiments.

[0039] Example 1

[0040] Figure 3 The flowchart of the document processing method according to Embodiment 1 of this application is illustrated in the figure. It may include steps S110 to S120, as follows:

[0041] Step S110: Obtain the target files from the installation package source files, where there are several target files.

[0042] The source files of the installation package, that is, the source files before they are compiled into the installation package.

[0043] In an exemplary embodiment, the target file is a dex file, that is, the dex file in the source file is optimized to reduce the size of the resulting installation package.

[0044] In step S110, the target files in the installation package source file are obtained, which may involve obtaining all the target files in the installation package source file.

[0045] Step S120: Compile the target files according to the preset compilation rules to obtain the installation package file. The preset compilation rules include at least determining the first file and the second file between the target files, and deleting at least part of the first file and / or the second file. The first file is the file of the referenced target class, and the second file is the file of the method of the referenced target class.

[0046] The preset compilation rules can include the rules mentioned above that delete at least part of the first file and / or the second file, along with other compilation rules, where the other compilation rules remain unchanged from the original Android system's compilation rules. Alternatively, it can include the above rules as well as other compilation rules different from the original Android system, thereby adapting to changes in compilation rules or further optimizing the size of the installation package. Specific compilation rules can be set according to actual needs, and no specific restrictions are imposed here.

[0047] It is understandable that multiple classes may be referenced in all target files, and the referenced target class refers to one of those classes. For example, if target file A references class 'a', and target file B references a method of class 'a', then class 'a' can be identified as the referenced target class; correspondingly, the file containing class 'a' is the file containing the referenced target class, i.e., the first file, and the file containing the method of class 'a' is the file containing the method of the referenced target class, i.e., the second file.

[0048] Since a class contains related methods, changing the reference of the second file to the first file will ensure that the reference of the target file containing the second file remains unaffected. Therefore, when optimizing the size of the installation package, it is advisable to delete at least some of the second files while retaining the first file. Alternatively, if multiple target files contain the same first file, some of the first files can be deleted, retaining some or one of them. Then, changing the reference of the corresponding first file to the retained first file will also ensure that the reference of the target file containing the deleted first file remains unaffected.

[0049] Since deleting at least part of the first file and / or the second file involves deleting files that contain class references, it is equivalent to deleting some of the duplicate class references. Therefore, the operation of deleting at least part of the first file and / or the second file can be called the operation of class reference deduplication; correspondingly, the first file and the second file can be regarded as duplicate class reference files.

[0050] The file processing method in this application obtains the target files in the installation package source file and compiles the target files according to preset compilation rules to obtain the installation package file. Since the preset compilation rules include deleting at least some files that reference the target class and / or the methods of the target class between the target files, the size of the installation package (APK) can be reduced, thereby effectively optimizing the size of the APK. At the same time, the reduction in the size of the installation package can reduce the memory space occupied by the client, improve the running efficiency of the app and the resource utilization of the client device, and also help to increase the download volume of the app.

[0051] In an exemplary embodiment, such as Figure 4 As shown, step S120 may include steps S121 to S122, as detailed below:

[0052] Step S121: Obtain the first and second files from all target files.

[0053] Step S122: If all target files contain the first file and the second file, the first file and the second file are identified as duplicate class reference files, and at least one second file is deleted.

[0054] Understandably, when all target files contain a first file and a second file, there can be one or more first files. If there is only one first file, it can be kept to ensure that the target files are referenced. If there are multiple first files, all first files can be kept, or at least one duplicate first file can be deleted, that is, at least one first file must be kept.

[0055] For example, if target files A, B, and C contain one first file and two second files, one or both second files can be deleted, while the first file is retained since there is only one first file.

[0056] For example, if target files A, B, and C contain two first files and one second file, then the second file can be deleted. Since there are two first files, one first file can be deleted, and one first file can be kept.

[0057] In this embodiment, by obtaining the first file and the second file among all target files, and in the case where the first file and the second file are included in all target files, the first file and the second file are identified as duplicate class reference files, and at least one second file is deleted. This can further expand the scope of duplicate class reference files, thereby optimizing more files and effectively reducing the size of the obtained installation package.

[0058] In an exemplary embodiment, such as Figure 5 As shown, step S120 may include steps S121' to S122', as follows:

[0059] Step S121': Obtain the first and second files from every pair of target files in all target files.

[0060] Step S122': If any two target files contain the first file and the second file, the first file and the second file are identified as duplicate files with the same class reference, and the second file is deleted.

[0061] It is understandable that when operating on each pair of target files, the possible situations include: (1) one target file contains the first file and the other target file contains the second file; (2) both target files contain the first file; (3) both target files contain the second file; (4) neither target file contains the first file or the second file (e.g., the two target files reference different classes). For cases (2) and (3), duplicate first and second files can be deleted to further optimize the size of the resulting installation package; that is, while deleting the second file using steps S121' to S122', the method of deleting duplicate first and second files can be combined to optimize the size of the installation package to the greatest extent.

[0062] In this embodiment, by obtaining the first and second files from every pair of target files in all target files, if any two target files contain the first and second files, the first and second files are identified as duplicate reference files, and the second file is deleted. Since the first file is retained, the references to the target files will not be affected. At the same time, by deleting as many second files as possible while retaining the first file, the size of the resulting installation package can be reduced to a greater extent.

[0063] In an exemplary embodiment, such as Figure 6 As shown, the file processing method may further include steps S123 to S124, as detailed below:

[0064] Step S123: Obtain the information of the retained first or second file as the first information.

[0065] It is understood that in the foregoing embodiments, either the first file or the second file may be retained. Therefore, the information of the retained first file or the second file can be obtained as the first information to modify the target file affected in the class reference deduplication operation.

[0066] The first piece of information may include, but is not limited to, file name, file path, etc.

[0067] Step S124: Modify the mapping table, mapping offset, and reference address in the target file according to the first information.

[0068] The mapping table can include a method reference mapping table and a class reference mapping table; the mapping offset refers to the offset generated by the modified reference position; and the reference address refers to the address corresponding to the modified reference position.

[0069] In step S124, modifying the mapping table, mapping offset, and reference address in the target files affected by the class reference deduplication operation can ensure that these affected target files reference the retained first or second file. Specifically, if a target file references a first or second file that is deleted during the class reference deduplication operation, the mapping table, mapping offset, and reference address in that target file can be modified based on the information of the retained first or second file, so that the target file references the retained first or second file, thus ensuring that the reference of that target file is not affected. When modifying the mapping table, mapping offset, and reference address in the target file, since the size of the dex file is reduced, the header file in the dex file can be modified at the end to correct the offset and size of the entire dex file.

[0070] In this embodiment, by obtaining the information of the retained first or second file as the first information, and modifying the mapping table, mapping offset, and reference address in the target file according to the first information, it is possible to optimize the size of the installation package through class reference deduplication while ensuring that the references of the target file are not affected.

[0071] Please refer to Figure 7 This is an example diagram of class reference deduplication in the target file. As shown in the diagram, before class reference deduplication:

[0072] (1) dex file 1, referencing classes A, B, and C;

[0073] (2) dex file 2, referencing Aa, Ab, class B, Ca, Cb;

[0074] (3) dex file 3, references Fa, Fb, B class, Ea, Eb.

[0075] Since class A in dex file 1 includes Aa and Ab in dex file 2, class B is the same as class B in dex file 2, and class C includes Ca and Cb in dex file 2, when deduplicating class references, the reference files in dex file 1 can be retained, and the references in dex file 2 can be changed to the classes referenced by dex file 1. At the same time, the method file mapping table and offset in dex file 2, the class file mapping table and offset can be modified, and finally the size and offset of the header file can be modified.

[0076] If class B in dex file 3 is the same as class B in dex file 1, then during class reference deduplication, the reference in dex file 3 can be changed to the class referenced in dex file 1. Simultaneously, the class file mapping table and offset in dex file 3 should be modified, and finally, the size and offset of the header file should be changed. Since dex file 3 does not involve method deduplication in the class reference deduplication operation, it is not necessary to modify the method file mapping table and offset.

[0077] In an exemplary embodiment, such as Figure 8 As shown, step S120, which involves compiling the target file according to preset compilation rules, may also include steps S210 to S230, as detailed below:

[0078] Step S210: Obtain the line number relationship table in all target files.

[0079] Step S220: Generate a global debug project file based on the line number relationship table, and store the global debug project file to the local disk.

[0080] Step S230: Delete the debug project file in each target file.

[0081] In this embodiment, the debug items file in the target file is the debug items file in the dex file. The debug items file mainly contains the following two types of information: (1) the parameter variables of the function and all local variables, and (2) the correspondence between the instruction set line number and the source file line number, where the instruction set is the instruction information that the compiler can read. Generally, when the app is performing local debugging, this information is used to find problems and locate the location of the problem. In addition, it can be used when reporting a crash or actively obtaining stack information when a problem occurs. Because the virtual machine running the dex file actually uses the instruction set when it is executed, when a problem occurs, this correspondence can be used to locate the line number of the programming language source file.

[0082] In some mainstream app scenarios, the size of the debug project file is 3-5M, and the release package is 2.5-4M. Optimizing this part can significantly reduce the size of the resulting installation package.

[0083] Specifically, you can obtain the line number relationship table in all target files, dump (export, save) the obtained line number relationship table into a dexpcmapping file (the mapping relationship between instruction set line numbers and source file line numbers), aggregate them together to generate a global debug project file, and store the global debug project file locally. Then, delete the debug project file in each target file. Finally, you can modify the anti-location rules of the problem line numbers in the target files, so that you can perform anti-location based on the global debug project file.

[0084] In this embodiment, by obtaining the line number relationship table in all target files, generating a global debug project file based on the line number relationship table, and storing the global debug project file locally, the debug project file in each target file is deleted. Since the size of the global debug project file is significantly reduced compared to the total size of the debug project files in all target files, the size of the resulting installation package can be effectively reduced.

[0085] In an exemplary embodiment, such as Figure 9 As shown, after step S230, that is, after deleting the debug project file in each target file, steps S240 to S260 may also be included, as follows:

[0086] Step S240: Obtain information from the global debug project file as the second information.

[0087] Step S250: Establish the correspondence between each target file and the global debug project file.

[0088] Step S260: Adjust the anti-location rules for the problem line numbers in each target file according to the correspondence and the second information.

[0089] In step S240, the information of the global debug project file may include, but is not limited to, the file name, file path, etc.

[0090] In step S250, each target file can be numbered, and a correspondence table between the target files and the global debugging project files can be established based on the numbering.

[0091] In step S260, adjusting the reverse location rules for the problem line numbers in each target file based on the correspondence and the second information means relocating the problem line numbers in each target file according to the global debug project file. This changes the process from previously finding a problem by searching the debug project file of the target file containing the problem line number, to finding a problem by searching the global debug project file. Specifically, this could involve finding the problematic instruction set on disk, locating the corresponding debug items, retrieving the source file line number, and then providing feedback to the developer for processing.

[0092] In this embodiment, by obtaining information from the global debug project file as the second information, a correspondence between each target file and the global debug project file is established. Based on the correspondence and the second information, the reverse location rules for the problem line numbers in each target file are adjusted, which can ensure the reverse location of the problem line numbers while optimizing the size of the installation package.

[0093] Example 2

[0094] Figure 10 The diagram illustrates a block diagram of a file processing apparatus 300 according to Embodiment 2 of this application. This file processing apparatus 300 can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiments of this application. The program modules referred to in the embodiments of this application are a series of computer program instruction segments capable of performing specific functions. The following description will specifically introduce the functions of each program module in this embodiment.

[0095] like Figure 10 As shown, the file processing device 300 may include an acquisition module 310 and a compilation module 320.

[0096] The acquisition module 310 is used to acquire target files from the installation package source file, wherein there are several target files;

[0097] The compilation module 320 is used to compile the target files according to preset compilation rules to obtain the installation package file. The compilation rules include at least class reference deduplication of the target files.

[0098] In an exemplary embodiment, the compilation module 320 is further configured to: determine the duplicate class reference files among the object files, and perform class reference deduplication on the duplicate class reference files.

[0099] In an exemplary embodiment, the compilation module 320 is further configured to: obtain a first file and a second file in all object files, wherein the first file is a file of the referenced target class and the second file is a file of the method of the referenced target class; if the first file and the second file are included in all object files, determine the first file and the second file as duplicate class reference files, and delete at least one second file.

[0100] In an exemplary embodiment, the compilation module 320 is further configured to: obtain a first file and a second file from every pair of object files in all object files, wherein the first file is a file of the referenced target class and the second file is a file of the method of the referenced target class; and if any two object files contain the first file and the second file, determine the first file and the second file as duplicate class reference files and delete the second file.

[0101] In an exemplary embodiment, the file processing device 300 further includes a modification module (not shown in the figure), wherein the modification module is configured to: obtain information of the retained first file or second file as first information; and modify the mapping table, mapping offset and reference address in the target file according to the first information.

[0102] In an exemplary embodiment, the target file is a dex file.

[0103] In an exemplary embodiment, the compilation module 320 is further configured to: obtain a line number relationship table in all object files; generate a global debug project file based on the line number relationship table and store the global debug project file to a local disk; and delete the debug project file in each object file.

[0104] In an exemplary embodiment, the compilation module 320 is further configured to: obtain information of the global debug project file as second information; establish a correspondence between each target file and the global debug project file; and adjust the anti-location rules of the problem line numbers in each target file according to the correspondence and the second information.

[0105] Example 3

[0106] Figure 11 The diagram schematically illustrates the hardware architecture of a computer device 400 suitable for a file processing method according to Embodiment 3 of this application. The computer device 400 can be a device capable of automatically performing numerical calculations and / or data processing according to pre-set or stored instructions. For example, it can be a rack server, blade server, tower server, or cabinet server (including standalone servers or server clusters composed of multiple servers), gateway, etc. Figure 11 As shown, the computer device 400 includes, but is not limited to, a memory 410, a processor 420, and a network interface 430 that can communicate with each other via a system bus. Wherein:

[0107] The memory 410 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 410 may be an internal storage module of the computer device 400, such as the hard disk or memory of the computer device 400. In other embodiments, the memory 410 may also be an external storage device of the computer device 400, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 410 may include both the internal storage module and the external storage device of the computer device 400. In this embodiment, the memory 410 is typically used to store the operating system and various application software installed on the computer device 400, such as program code for file processing methods. In addition, the memory 410 can also be used to temporarily store various types of data that have been output or will be output.

[0108] In some embodiments, processor 420 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. Processor 420 is typically used to control the overall operation of computer device 400, such as performing control and processing related to data interaction or communication with computer device 400. In this embodiment, processor 420 is used to run program code stored in memory 410 or process data.

[0109] Network interface 430 may include a wireless network interface or a wired network interface, which is typically used to establish a communication link between computer device 400 and other computer devices. For example, network interface 430 is used to connect computer device 400 to an external terminal via a network, establishing a data transmission channel and communication link between computer device 400 and the external terminal. The network may be an intranet, the Internet, Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or other wireless or wired networks.

[0110] It should be pointed out that, Figure 11 Only a computer device with components 410-430 is shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0111] In this embodiment, the file processing method stored in memory 410 can be further divided into one or more program modules and executed by one or more processors (processor 420 in this embodiment) to complete the embodiment of this application.

[0112] Example 4

[0113] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the file processing method in the embodiments.

[0114] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device. Of course, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device, such as the program code of the file processing method in the embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.

[0115] Obviously, those skilled in the art should understand that the modules or steps of the embodiments of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of this application are not limited to any particular combination of hardware and software.

[0116] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A file processing method, characterized in that, include: Obtain the target files from the installation package source files, wherein there are several target files; The target files are compiled according to preset compilation rules to obtain an installation package file. The compilation rules include at least identifying a first file and a second file between the target files and deleting at least a portion of the first file and / or the second file. The first file is a file of the referenced target class, and the second file is a file of the method of the referenced target class. The step of compiling the target file according to preset compilation rules further includes: Obtain the line number relationship table for all the target files; A global debug project file is generated based on the row number relationship table, and the global debug project file is stored on the local disk; Delete the debug project file in each of the target files.

2. The file processing method according to claim 1, characterized in that, The step of determining the first and second files between the target files and deleting at least a portion of the first and / or second files includes: Obtain the first file and the second file from all the target files; If all the target files contain both the first file and the second file, the first file and the second file are identified as duplicate class reference files, and at least one of the second files is deleted.

3. The file processing method according to claim 1, characterized in that, The step of determining the first and second files between the target files and deleting at least a portion of the first and / or second files includes: Obtain the first file and the second file from every two of the target files; If any two of the target files contain the first file and the second file, the first file and the second file are identified as duplicate class reference files, and the second file is deleted.

4. The document processing method according to claim 2 or 3, characterized in that, Also includes: Obtain the information of the retained first file or second file as the first information; Modify the mapping table, mapping offset, and reference address in the target file based on the first information.

5. The file processing method according to claim 1, characterized in that, The target file is a dex file.

6. The file processing method according to claim 1, characterized in that, After deleting the debug project file in each of the first files, the method further includes: Obtain the information from the global debug project file as the second information; Establish the correspondence between each target file and the global debug project file; The anti-location rules for the problem line numbers in each of the target files are adjusted based on the correspondence and the second information.

7. A document processing device, characterized in that, include: The acquisition module is used to acquire target files from the installation package source file, wherein there are several target files; A compilation module is used to compile the target files according to preset compilation rules to obtain an installation package file. The compilation rules include at least determining a first file and a second file between the target files and deleting at least a portion of the first file and / or the second file. The first file is a file of the referenced target class, and the second file is a file of the method of the referenced target class. The step of compiling the target file according to preset compilation rules further includes: Obtain the line number relationship table for all the target files; A global debug project file is generated based on the row number relationship table, and the global debug project file is stored on the local disk; Delete the debug project file in each of the target files.

8. A computer device, the computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the file processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by at least one processor to cause the at least one processor to perform the steps of the file processing method according to any one of claims 1 to 6.

10. A computer program product comprising computer instructions, characterized in that, When executed by a processor, the computer instructions implement the steps of the method according to any one of claims 1 to 6.