Hot repair method and device, electronic equipment and storage medium
By performing bytecode analysis and annotation marking on AAR files, patch files are generated to achieve hot repair of AAR files, which solves the problem of being unable to hot repair AAR files in the existing technology and improves the repair efficiency and flexibility of applications.
Patent Information
- Application Number
- CN202310334615.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2024-10-01
AI Technical Summary
The existing hot repair framework cannot hot repair the binary archive file (AAR) of the Android library project, resulting in the AAR file being unable to be repaired during the application hot repair process.
By obtaining the AAR file to be repaired in the application, parsing it using the parsing rules of AAR type bytecode, locating and annotating the target code function, and repackaging it to generate a patch file, the hot repair of the AAR file is realized.
The hot repair of AAR files in applications is implemented, which solves the problem of being unable to hot repair AAR files without affecting the original repair framework logic.
Smart Images

Figure CN118733307A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and for example, to a thermal repair method, device, electronic device and storage medium. Background Art
[0002] Hot fixes are used to fix online faults without releasing new versions. As a technical means to quickly resolve online anomalies in Internet technology (IT) products, they are very important for mobile applications.
[0003] Currently, open source hot fix frameworks (such as Robust and other tools) can be used for hot fixes. However, for binary archive files (Android Archive, AAR) of Android library projects, such as third-party AAR files that applications depend on or AAR files written by users, the hot fix framework cannot provide the corresponding hot fix capabilities, which will cause the problem that the AAR files cannot be hot fixed during the hot fix process of the application. Summary of the invention
[0004] In view of this, the present application provides a hot repair method, device, electronic device and storage medium, the main purpose of which is to solve the technical problem that AAR files cannot be hot repaired during the current hot repair process of applications.
[0005] In a first aspect, the present application provides a thermal repair method, comprising:
[0006] Get the AAR file to be repaired in the application;
[0007] The AAR file is parsed using the parsing rules of the AAR type bytecode to obtain first AAR bytecode information of the AAR file; wherein the first AAR bytecode information includes a plurality of code functions into which code information for supporting hot fixes has been inserted;
[0008] Locating the target code function that needs hot-fixing in the first AAR bytecode information, and annotating the target code function to obtain the first AAR bytecode information with the annotation mark;
[0009] Repackaging the AAR file according to the first AAR bytecode information with annotation marks;
[0010] Based on the AAR file obtained through the repackaging process, a patch file required for hot-fixing the application is generated.
[0011] In a second aspect, the present application provides a thermal repair device, comprising:
[0012] The acquisition unit is used to obtain the AAR file to be repaired in the application;
[0013] A parsing unit, configured to parse the AAR file using a parsing rule of an AAR type bytecode to obtain first AAR bytecode information of the AAR file; wherein the first AAR bytecode information includes a plurality of code functions into which code information for supporting hot fixes has been inserted;
[0014] A marking unit, used for locating a target code function that needs hot-fixing in the first AAR bytecode information, and annotating the target code function to obtain the first AAR bytecode information with the annotation mark;
[0015] A processing unit, configured to repackage the AAR file according to the first AAR bytecode information with annotation marks;
[0016] The generating unit is used to generate a patch file required for hot-fixing the application based on the AAR file obtained by the repackaging process.
[0017] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the thermal repair method described in the first aspect.
[0018] In a fourth aspect, the present application provides an electronic device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the thermal repair method described in the first aspect when executing the computer program.
[0019] By means of the above technical scheme, the present application provides a hot repair method, device, electronic device and storage medium, firstly obtains the AAR file to be repaired in the application and parses it using the parsing rules of the AAR type bytecode to obtain the first AAR bytecode information of the AAR file. Among them, the first AAR bytecode information includes multiple code functions that have been inserted with code information for supporting hot repair. Then, the target code function that needs hot repair can be located in the first AAR bytecode information, and annotated so as to be used for hot repair of the content related to the target code function in the subsequent process. Finally, the file with the annotated first AAR bytecode information is repackaged to obtain an AAR file, and then the patch file required for hot repair of the application is generated based on the AAR file obtained by the repackaged process. Compared with the related art, the present application obtains the first AAR bytecode information using the parsing rules of the AAR type bytecode, and then locates the target code function that needs hot repair in the first AAR bytecode and annotates it, so that it can be hot repaired according to the patch file generated after packaging according to the annotation mark, so that the AAR file in the application can be hot repaired in the process of hot repairing the application.
[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0023] Figure 1 A schematic diagram of a process of a thermal repair method provided in an embodiment of the present application is shown;
[0024] Figure 2 A schematic diagram of a process of another thermal repair method provided in an embodiment of the present application is shown;
[0025] Figure 3 A schematic diagram of a process of another thermal repair method provided in an embodiment of the present application is shown;
[0026] Figure 4A schematic diagram of a process of another thermal repair method provided in an embodiment of the present application is shown;
[0027] Figure 5 A schematic structural diagram of a thermal repair device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0028] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0029] Hotfix, also known as patch, refers to some code that can fix software vulnerabilities without version replacement. It is a fast and low-cost way to fix defects in product software versions. It can be hot-fixed using an open source hot-fix framework (such as Robust and other tools). However, for AAR (Android Archive) files, such as third-party AAR files that applications rely on or AAR files written by users, the hot-fix framework cannot provide the corresponding hot-fix capabilities, which will result in the inability to repair AAR files during the hot-fix process of the application.
[0030] In order to solve the above problem, this embodiment proposes a hot repair method, device, electronic device and storage medium, which can implement hot repair of the AAR file of the application during the hot repair of the application.
[0031] like Figure 1 As shown, a thermal repair method provided by this embodiment is shown. The method includes:
[0032] Step 101: Obtain the AAR file to be repaired in the application.
[0033] The application in this embodiment may refer to an application including an AAR file that needs to be repaired, for example, a video application, an audio application, a map application, a communication application, a browser application, etc. in a vehicle system. The AAR file to be repaired in the application refers to a file of the AAR type, such as a third-party AAR file that the application depends on or an AAR file written by a user.
[0034] The execution subject of this embodiment may be a hot repair device or equipment, which may be configured on the server side.
[0035] Step 102: parse the AAR file using the parsing rules of the AAR type bytecode to obtain the first AAR bytecode information of the AAR file.
[0036] In this embodiment, the parsing rules of AAR type bytecode may be rules for parsing AAR type bytecode. The first AAR bytecode information of the AAR file may be obtained by parsing using the parsing rules of AAR type bytecode. The first AAR bytecode information includes multiple code functions (or code methods) that have been inserted into the code information to support hot fixes. These code functions are used to execute different code functions, such as obtaining XX objects, calling XX interfaces, and other code functions.
[0037] Step 103: locate the target code function that needs hot-fixing in the first AAR bytecode information, and annotate the target code function to obtain the first AAR bytecode information with annotations.
[0038] For example, among the various code functions in the first AAR bytecode information, the target code function that needs to be hot-repaired is determined, and the need for hot-repairing of the target code function can be indicated by marking it with annotations. For example, annotations such as modifying, replacing, deleting, etc. can be used to indicate that the target code function needs to be repaired by modifying, replacing, deleting, etc.
[0039] Step 104: Repack the AAR file according to the first AAR bytecode information with the annotation mark.
[0040] In this embodiment, since the target code function is annotated and the content in the original file is changed, the AAR file needs to be repackaged according to the first AAR bytecode information after the annotation.
[0041] Step 105: Generate a patch file required for hot-fixing the application based on the AAR file obtained by the repackaging process.
[0042] The patch file can be an executable file, which may include the repair logic content of the target code function corresponding to the above-mentioned annotation mark, such as the repair logic of modifying, replacing, deleting, etc. the target code function. The client can subsequently execute the patch file and then execute the repair logic content to perform hot repair on the corresponding AAR file in the local application. In this way, there is no need to release a new version of the application, and the content of the AAR file in the client application can be repaired through the patch file.
[0043] It should be noted that, in addition to using the method of this embodiment to perform hot repair on the AAR file in the application, the method of this embodiment can also be used to perform hot repair on other specific files in the application, such as the JAR file in the application.
[0044] By applying the technical solution of this embodiment, the AAR file to be repaired in the application is first obtained and parsed to obtain the first AAR bytecode information. Then the target code function that needs hot repair is located, and annotated for subsequent repair. Finally, the AAR file obtained by repackaging the annotated file is generated to generate the patch required for hot repair. Compared with the related art, this embodiment uses the first AAR bytecode information obtained by the parsing rules of the AAR type bytecode, and then locates the target code function that needs hot repair in the first AAR bytecode and annotates it, so that it can be hot-repaired according to the patch file generated by packaging after annotation, which solves the problem of not being able to hot-repair the AAR file.
[0045] Furthermore, as some optional embodiments, in order to enable the AAR file to support this hot repair method, before step 101, the method of this embodiment may also include: first identifying an AAR file in the application whose bytecode type is an AAR type bytecode; then using the parsing rules of the AAR type bytecode to parse the AAR file to obtain second AAR bytecode information of the AAR file; then inserting code information for supporting hot repair into each code function of the second AAR bytecode information; and then rewriting the second AAR bytecode information after the code information is inserted into the AAR file.
[0046] In this embodiment, it is introduced that before implementing the above method, the AAR file needs to be pre-processed in advance. Specifically, it includes identifying the file type that needs to be repaired. When the type is not an AAR file type, the repair is performed according to the original Robust repair logic; when the type is an AAR type, the AAR file is parsed using the parsing rules of the AAR type bytecode to obtain the second AAR bytecode information. The second AAR bytecode here includes multiple code functions that are not inserted with code information for supporting hot repair. The code information for supporting hot repair is inserted into each code function of the second AAR bytecode information and rewritten into the AAR file. After re-parsing, the first AAR bytecode information directly located to the target code function that needs hot repair can be obtained. By inserting code information for supporting hot repair in the AAR file that needs to be repaired in advance, each target code function that needs hot repair can be located according to the code information, and corresponding annotations can be marked. As a result, hot repair can be performed according to the patch file generated after marking, and a new repair logic is introduced into the existing AAR file that cannot support the hot repair function, so that the hot repair function can be supported.
[0047] It should be noted that the reason why plugging is supported is that before the hot fix is implemented, the code information for supporting hot fixes has been inserted into the code function in advance, thereby obtaining the first AAR bytecode information. Further, each target code function that needs hot fixes can be located in the first AAR bytecode information, and the corresponding annotations can be marked. As a result, hot fixes can be performed according to the patch files generated after marking, and new repair logic is introduced into the existing AAR files that cannot support the hot fix function, so that the hot fix function can be supported. In addition, if the repair is based on Robust, the repair logic also follows the original repair logic of Robust. Only the code information for supporting hot fixes is inserted in advance into the AAR files that cannot be repaired, which has little impact on Robust as a whole.
[0048] As some optional embodiments, annotating the target code function in step 103 may specifically include: annotating the target code function using the code information corresponding to the target code function inserted to support hot fixes, wherein the annotation includes: marks for adding (Add) information, and / or modifying (Modify) information, and / or deleting (Delete) information.
[0049] In this embodiment, the purpose of the annotation mark is to mark how to repair the target code function, that is, the function that needs hot repair. For example, the Add annotation mark can be used to add information to the target code function, and the Modify annotation mark can be used to modify the information of the target code function. By adding annotation marks to the code method to be modified, the subsequent repair process is more convenient and simple to operate, which can improve the efficiency of the corresponding repair operation.
[0050] As some optional embodiments, step 105 may specifically include: marking the AAR file obtained by the repackaging process with a repair version number, for example, if the original version number is 2.0.1 and the repair version number is 2.0.2, marking the repair version number according to 2.0.2; then integrating the AAR file marked with the repair version number through the source project, and obtaining the repair logic information of the AAR file according to the annotation mark; and then generating a patch file according to the repair logic information.
[0051] In this embodiment, the steps of how to generate a patch file are introduced. After annotation marking, the AAR file is repackaged and output or uploaded to the Maven repository (a service based on simple file system storage that centrally manages Java API resources / components), and the repair version is marked. Then the source project is integrated through the AAR file with the repair version mark, and a patch file is generated based on the repair logic information. Finally, the hot repair service can load the patch file to implement the hot repair of the internal logic of the AAR file. The above method does not affect the original repair framework logic and has little impact on the repair framework.
[0052] Further optionally, after using the AAR file obtained by the repackaging process to generate the patch file required for hot repairing the application, the method of this embodiment may also include: sending the patch file to the client, such as sending it to the client through the server, so that the client can perform hot repair on the corresponding AAR file in the application according to the repair operation information corresponding to the repair logic information by executing the patch file. The server may be a server in a server, which may be a cloud server, or an integrated server deployed locally.
[0053] In this embodiment, by sending the patch file to the client and executing it, the corresponding AAR file in the application is hot-repaired according to the repair operation information corresponding to the repair logic information, so that the hot repair service can load the patch file to implement the hot repair work of the internal logic of the AAR file, with little impact on the repair framework.
[0054] Further optionally, after sending the patch file to the client through the server, the method of this embodiment may also include: saving the hot repair record of the AAR file; responding to the hot repair exception information of the application reported by the client, analyzing the hot repair exception cause information of the application based on the hot repair record.
[0055] In this embodiment, the thermal repair record can also be saved, and when an abnormal situation occurs, the relevant information of the thermal repair is retrieved and the cause of the abnormal situation is analyzed. By providing a traceability channel, the reliability of the thermal repair method can be made higher.
[0056] Optionally, before identifying an AAR file whose bytecode type is an AAR type bytecode in an application, the method of this embodiment may further include: obtaining package name information of the AAR file; and then adding an access path of the AAR file in a file path supporting hot fixes according to the package name information. Accordingly, identifying an AAR file whose bytecode type is an AAR type bytecode in an application includes: identifying an AAR file corresponding to the access path.
[0057] In this embodiment, it is mentioned that in addition to the need to insert code information for supporting hot repair in the AAR file in advance, the specified AAR code path can also be added during the access process of the hot repair framework, that is, the package name information and file path of the AAR file to be repaired are added to the hot repair framework in advance, so as to obtain the AAR file to be repaired more quickly and accurately.
[0058] Further, as a refinement and extension of the above embodiment, in order to fully illustrate the specific implementation process of the method of this embodiment. Taking the Robust hot fix framework as an example, this embodiment provides the following Figure 2 The specific method shown includes:
[0059] Step 201: Identify an AAR file whose bytecode type in the application is an AAR type bytecode.
[0060] In order to enable the Robust hot fix framework to provide hot fix capabilities for AAR files, the Robust hot fix framework needs to support the plugging of AAR files (a technology for implementing logical replacement for bytecodes). To achieve this goal, the process shown in steps 201 to 204 can be executed.
[0061] In step 201, the identification process specifically includes identifying the file type to be repaired, and if the type is not an AAR file type, repairing it according to the original Robust repair logic; if the type is an AAR type, executing step 202, parsing the AAR file using the parsing rules of the AAR type bytecode to obtain the second AAR bytecode information. The second AAR bytecode information includes a plurality of code functions without inserting the code information for supporting hot repair.
[0062] In some examples, before step 201, the method of this embodiment may further include: first obtaining package name information of the AAR file; and then adding an access path of the AAR file according to the package name information in a file path supporting hot fix.
[0063] In this embodiment, it is mentioned that in addition to inserting code information for supporting hot repair in the AAR file in advance, the specified AAR code path can also be added during the robust access process, that is, the package name information and file path of the AAR file to be repaired are added to Robust in advance, so as to obtain the AAR file to be repaired more quickly and accurately.
[0064] Step 202: parse the bytecode generated by the AAR file using the parsing rule of the AAR type bytecode to obtain second AAR bytecode information of the AAR file.
[0065] Step 203: Insert code information for supporting hot fix into each code function of the second AAR bytecode information.
[0066] Step 204: rewrite the second AAR bytecode information after the code information is inserted into the AAR file.
[0067] In this step, the second AAR bytecode here refers to the initial bytecode without the code information for supporting hot repair inserted. The code information for supporting hot repair is inserted into each code function of the second AAR bytecode information and rewritten into the AAR file. In this way, after further parsing, the first AAR bytecode information directly located to the target code function that needs hot repair can be obtained. By inserting the code information for supporting hot repair into the AAR file that needs to be repaired in advance, each target code function that needs hot repair can be located according to the code information, and the corresponding annotation mark can be made. Thereby, hot repair can be performed according to the patch file generated after marking, and a new repair logic is introduced into the existing AAR file that cannot support the hot repair function, so that the hot repair function can be supported.
[0068] After the Robust hot fix framework supports the AAR file plugging technology, the specific hot fix process shown in step 205 to step 209 can be continued.
[0069] Step 205: When an AAR file is needed for hot repair, obtain the AAR file.
[0070] In this step, the AAR file here refers to a file that has been repackaged and into which code information for supporting hot fixes has been inserted.
[0071] Step 206: parse the AAR file using the parsing rules of the AAR type bytecode to obtain the first AAR bytecode information of the AAR file.
[0072] Step 207: locate the target code function that needs to be hot-fixed in the first AAR bytecode information, and annotate the target code function to obtain the first AAR bytecode information with the annotation mark.
[0073] In this step, the purpose of annotation is to mark how to repair the target code function, that is, near the function that needs hot fix. In some examples, annotating the target code function in step 207 may specifically include: annotating the target code function using the code information inserted corresponding to the target code function, wherein the annotation includes: adding information, and / or modifying information, and / or deleting information.
[0074] For example, you can use the Add annotation to add information, and use the Modify annotation to modify information. By adding annotations to the code method to be modified, the subsequent repair process is more convenient.
[0075] Step 208: Repack the AAR file according to the first AAR bytecode information with the annotation mark.
[0076] Step 209: Generate a patch file required for hot-fixing the application based on the AAR file obtained by the repackaging process.
[0077] In some examples, step 209 may specifically include: marking the AAR file obtained by repackaging with a repair version; integrating the AAR file with the repair version mark through the source project, and obtaining the repair logic information of the AAR file based on the annotation mark; and generating a patch file according to the repair logic information.
[0078] In this embodiment, the steps of how to generate a patch file are introduced. After annotation marking, the AAR file is repackaged and output or uploaded to the Maven repository (a service based on simple file system storage that centrally manages Java API resources / components), and the repair version is marked. Then the source project is integrated through the AAR file with the repair version mark, and a patch file is generated based on the repair logic information. Finally, the hot repair service can load the patch file to implement the hot repair of the internal logic of the AAR file. The above method does not affect the original repair framework logic and has little impact on the repair framework.
[0079] In some examples, after step 209, the method of this embodiment may also include: sending the patch file to the client via the cloud, so that the client executes the patch file and performs hot repair on the corresponding AAR file in the application according to the repair operation information corresponding to the repair logic information.
[0080] In this embodiment, by sending the patch file to the client and executing it, the corresponding AAR file in the application is hot-repaired according to the repair operation information corresponding to the repair logic information, so that the hot repair service can load the patch file to implement the hot repair work of the internal logic of the AAR file, with little impact on the repair framework.
[0081] In some examples, after the patch file is sent to the client via the cloud, the method of this embodiment may also include: saving a hot fix record of the AAR file; in response to hot fix exception information of the application reported by the client, analyzing the hot fix exception cause information of the application based on the hot fix record.
[0082] In this step, the thermal repair record can also be saved, and when an abnormal situation occurs, the relevant information of the thermal repair is retrieved and the cause of the abnormal situation is analyzed. By providing a traceability channel, the reliability of the thermal repair method can be made higher.
[0083] For example, Figure 3 As shown, a method of how to make AAR files support hot repair is introduced. First, it is necessary to add the definition of the AAR code path to the instrumentation path. Specifically, the package name information and file path can be connected to the Robust method in advance as mentioned in the above embodiment, which will not be repeated here. Then, the bytecode of the AAR type is parsed during the instrumentation process, and the code information for supporting hot repair is inserted into each target code file. Each target code function that needs hot repair can be located according to the code information, and the corresponding annotation mark can be made. Thereby, hot repair can be performed according to the patch file generated after marking, and a new repair logic is introduced into the existing AAR file that cannot support the hot repair function, so that the hot repair function can be supported.
[0084] like Figure 4 As shown, an example of the hot repair method provided by this embodiment is shown. First, a hot repair dependency is added to the AAR project. That is, on the one hand, the package name information and file path of the AAR file to be repaired are added to Robust as described above, and on the other hand, the code information for supporting hot repair is inserted in advance in the AAR file to be repaired, so that the AAR file can support the hot repair function. Then, after parsing the AAR file, the target code function that needs to be hot repaired can be located through the code information for supporting hot repair, and the internal logic can be modified by annotation marking at the location of the code information. The specific marking method can be through modifying the mark Modify or adding the mark Add, etc. After the annotation marking, the AAR file is repackaged and output or uploaded to the Maven warehouse, and the repair version mark is performed. Then the source project is integrated through the AAR file with the repair version mark, and a patch file is generated according to the repair logic information. Finally, the patch file is sent to the client to apply it, and the AAR file can be hot repaired. Through the above method, the code information for supporting hot fixes is pre-embedded in the AAR file that needs to be repaired, and the package name information and file path are connected to Robust in advance. The target code function that needs hot fixes is located using the code information, and annotated and marked. Therefore, the hot fix can be performed according to the generated patch file, solving the problem of being unable to perform hot fixes on AAR files. In addition, the original Robust repair framework has little impact and can be implemented without major modifications.
[0085] Optionally, after sending it to the client, the hot repair record of the AAR file can also be saved, and in response to the hot repair exception information of the application reported by the client, the hot repair exception cause information of the application can be analyzed based on the hot repair record, so that the reliability of the above hot repair method can be higher.
[0086] As Figures 1 to 4 The specific implementation of the method shown in this embodiment provides a thermal repair device, such as Figure 5 As shown, the device includes: an acquisition module 501, a parsing unit 502, a marking unit 503, a processing unit 504, and a generating unit 505.
[0087] An acquisition unit 501 is used to acquire an AAR file to be repaired in an application;
[0088] A parsing unit 502 is used to parse the AAR file using a parsing rule of an AAR type bytecode to obtain first AAR bytecode information of the AAR file; wherein the first AAR bytecode information includes a plurality of code functions into which code information for supporting hot fixes has been inserted;
[0089] The marking unit 503 is used to locate the target code function that needs hot-fixing in the first AAR bytecode information, and annotate the target code function to obtain the first AAR bytecode information with annotations;
[0090] A processing unit 504 is used to repackage the AAR file according to the first AAR bytecode information with annotation marks;
[0091] The generating unit 505 is used to generate a patch file required for hot-fixing the application based on the AAR file obtained by the repackaging process.
[0092] In a specific application scenario, the processing unit 504 is specifically used to identify the AAR file in the application whose bytecode type is AAR type bytecode; parse the AAR file using the parsing rule of the AAR type bytecode to obtain second AAR bytecode information of the AAR file; wherein the second AAR bytecode information includes multiple code functions without inserting code information for supporting hot repair; inserting code information for supporting hot repair into each code function of the second AAR bytecode information; and rewriting the second AAR bytecode information after inserting the code information into the AAR file.
[0093] In a specific application scenario, the marking unit 503 is specifically used to annotate the target code function using the code information corresponding to the target code function and used to support hot repair, wherein the annotation mark includes: a mark for adding information, and / or modifying information, and / or deleting information.
[0094] In a specific application scenario, the generation unit 505 is specifically used to mark the repair version number of the AAR file obtained by the repackaging process; integrate the AAR file marked with the repair version number through the source project, and obtain the repair logic information of the AAR file according to the annotation mark; generate the patch file according to the repair logic information.
[0095] In a specific application scenario, the processing unit 504 is further used to send the patch file to the client, so that the client can execute the patch file and perform hot repair on the corresponding AAR file in the application according to the repair operation information corresponding to the repair logic information.
[0096] In a specific application scenario, the processing unit 504 is further configured to save a hot fix record of the AAR file; and in response to the hot fix exception information of the application reported by the client, analyze the hot fix exception cause information of the application based on the hot fix record.
[0097] In a specific application scenario, the acquisition unit 501 is further used to acquire the package name information of the AAR file; and in the file path supporting hot fix, add the access path of the AAR file according to the package name information.
[0098] In a specific application scenario, the processing unit 504 is further configured to identify the AAR file corresponding to the access path.
[0099] It should be noted that for other corresponding descriptions of the functional units involved in the thermal repair device provided in this embodiment, please refer to Figures 1 to 4 The corresponding description in will not be repeated here.
[0100] Based on the above Figures 1 to 4 The method shown in the embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned Figures 1 to 4 The method shown.
[0101] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.
[0102] Based on the above Figures 1 to 4 The method shown, and Figure 5 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides an electronic device, which can be configured on a computer terminal side or a storage medium terminal side, etc. The device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figures 1 to 4 The method shown.
[0103] Optionally, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0104] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.
[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware. The first AAR bytecode information is obtained by using the parsing rules of the AAR type bytecode, and then the target code function that needs to be hot-fixed is located in the first AAR bytecode and annotated, so that it can be hot-fixed according to the patch file generated by packaging according to the annotation, solving the problem of being unable to hot-fix the AAR file.
[0106] It should be noted that, in this article, relational terms such as "first" and "second" 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 term "comprises" or any other variant thereof is 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 existence of other identical elements in the process, method, article or device including the elements.
[0107] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can 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 described herein, but will conform to the widest scope consistent with the principles and novel features applied for herein.
Claims
1. A thermal repair method, characterized in that: include: Get the AAR file to be repaired in the application; The AAR file is parsed using the parsing rules of the AAR type bytecode to obtain first AAR bytecode information of the AAR file; wherein the first AAR bytecode information includes a plurality of code functions into which code information for supporting hot fixes has been inserted; Locating the target code function that needs hot-fixing in the first AAR bytecode information, and annotating the target code function to obtain the first AAR bytecode information with the annotation mark; Repackaging the AAR file according to the first AAR bytecode information with annotation marks; Based on the AAR file obtained through the repackaging process, a patch file required for hot-fixing the application is generated.
2. The method according to claim 1, characterized in that Before obtaining the AAR file to be repaired in the application, the method further includes: Identify the AAR file whose bytecode type in the application is AAR type bytecode; The AAR file is parsed using the parsing rule of the AAR type bytecode to obtain second AAR bytecode information of the AAR file; wherein the second AAR bytecode information includes a plurality of code functions without inserting code information for supporting hot fix; Inserting code information for supporting hot fix in each code function of the second AAR bytecode information; The second AAR bytecode information after the code information is inserted is rewritten into the AAR file.
3. The method according to claim 2, characterized in that The annotating and marking the target code function includes: The target code function is annotated using the code information for supporting hot fixes inserted corresponding to the target code function, wherein the annotation includes: a mark for adding information, and / or modifying information, and / or deleting information.
4. The method according to any one of claims 1 to 3, characterized in that The generating of a patch file required for hot-fixing the application based on the AAR file obtained by the repackaging process includes: Mark the AAR file obtained by repackaging with the repair version number; Performing integration processing on the AAR file marked with the repair version number through source engineering, and obtaining repair logic information of the AAR file according to the annotation mark; The patch file is generated according to the repair logic information.
5. The method according to claim 4, characterized in that After generating a patch file required for hot-fixing the application by using the AAR file obtained by the repackaging process, the method further includes: The patch file is sent to the client, so that the client performs hot repair on the corresponding AAR file in the application according to the repair operation information corresponding to the repair logic information by executing the patch file.
6. The method according to claim 5, characterized in that After sending the patch file to the client through the server, the method further includes: Save the hot fix record of the AAR file; In response to the hot repair exception information of the application reported by the client, the hot repair exception cause information of the application is analyzed based on the hot repair record.
7. The method according to claim 2, characterized in that Before the step of identifying the AAR file whose bytecode type in the application is an AAR type bytecode, the method further includes: Get the package name information of the AAR file; In the file path supporting hot fix, add the access path of the AAR file according to the package name information; The identifying the AAR file whose bytecode type in the application is an AAR type bytecode includes: The AAR file corresponding to the access path is identified.
8. A thermal repair device, characterized in that: include: The acquisition unit is used to obtain the AAR file to be repaired in the application; A parsing unit, configured to parse the AAR file using a parsing rule of an AAR type bytecode to obtain first AAR bytecode information of the AAR file; wherein the first AAR bytecode information includes a plurality of code functions into which code information for supporting hot fixes has been inserted; A marking unit, used for locating a target code function that needs hot-fixing in the first AAR bytecode information, and annotating the target code function to obtain the first AAR bytecode information with the annotation mark; A processing unit, configured to repackage the AAR file according to the first AAR bytecode information with annotation marks; The generating unit is used to generate a patch file required for hot-fixing the application based on the AAR file obtained by the repackaging process.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
