An abnormal positioning processing method and device, electronic equipment and storage medium

By using a custom Gradle plugin to obtain and analyze class files in Android projects, the problem of quickly locating application crashes was solved, and the efficiency of crash repair was improved.

CN113791966BActive Publication Date: 2026-02-27WUBA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110730145.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-29
Publication Date
2026-02-27
Estimated Expiration
2041-06-29

Smart Images

  • Figure CN113791966B_ABST
    Figure CN113791966B_ABST
Patent Text Reader

Abstract

The application provides an abnormal positioning processing method and device, electronic equipment and storage medium. The method comprises the following steps: obtaining target files of a specified type in a target project through a self-defined Gradle plug-in, wherein the target files of the specified type comprise at least one of class files, jar files and arr files; traversing each class file in each target file and obtaining class related information of each class file; the class related information at least comprises object identification of an object called by the class file, and the object comprises at least one of a method and an interface; based on the class related information of each class file, target class files meeting abnormal positioning conditions are obtained according to abnormal positioning conditions configured in the Gradle plug-in, and the abnormal positioning conditions at least comprise calling a specified object.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and in particular to an exception positioning processing method and device, electronic equipment and storage medium. BACKGROUND

[0002] An application program usually integrates many third-party aar (Android Archive, which is a binary archive file of an Android library project) and some capabilities provided by the group's internal SDK, such as push, authentication, live broadcast and other functions. However, during the running of the application program, some crash problems are often encountered, and some reasons for the crash problems cannot be quickly located through stack information.

[0003] In related technologies, in order to locate the reasons for the crash problems, the apk (Android Package) is usually decompiled by using a decompilation tool and then globally searched. However, when the apk file is large, the decompilation tool may report a memory leak problem or fail to decompile due to the apk hardening. This also affects the quick positioning and crash repair when the crash occurs. SUMMARY

[0004] Embodiments of the present application provide an exception positioning processing method and device, electronic equipment and storage medium to solve the problem of inaccurate existing crash exception positioning.

[0005] To solve the above technical problems, the present application is implemented as follows:

[0006] In a first aspect, the embodiments of the present application provide an exception positioning processing method, comprising:

[0007] A Gradle plug-in is defined to obtain target files of a specified type in the target project, wherein the target files of the specified type include at least one of class files, jar files and arr files.

[0008] Each class file in each target file is traversed, and class-related information of each class file is obtained, wherein the class-related information at least includes object identification of an object called by the class file, and the object includes at least one of a method and an interface.

[0009] Based on the class-related information of each class file, target class files meeting an exception positioning condition configured in the Gradle plug-in are obtained, wherein the exception positioning condition at least includes calling a specified object.

[0010] Optionally, before the step of obtaining the target files of the specified type in the target project through the custom Gradle plugin, the method further comprises:

[0011] creating a custom Gradle plugin project, and creating a Gradle plugin class in the Gradle plugin project;

[0012] creating a Transform class in the Gradle plugin class to obtain the target files of the specified type in the project;

[0013] The Transform class further comprises at least target logic code, which is executed to traverse each class file in each target file and obtain class-related information of each class file; based on the class-related information of each class file, target class files meeting the exception positioning condition are obtained according to the exception positioning condition configured in the Gradle plugin;

[0014] introducing the Gradle plugin project into the target project, and configuring the exception positioning condition for the target project in the Gradle plugin project.

[0015] Optionally, the step of obtaining the target class files meeting the exception positioning condition based on the class-related information of each class file and according to the exception positioning condition configured in the Gradle plugin comprises:

[0016] apk packaging the target project into which the Gradle plugin project is introduced, to obtain target class-related information meeting the exception positioning condition based on the class-related information of each class file and according to the exception positioning condition configured in the Gradle plugin, and output the target class-related information to a specified result file;

[0017] obtaining the specified result file, and positioning to the target class file corresponding to each target class-related information.

[0018] Optionally, the step of traversing each class file in each target file and obtaining class-related information of each class file comprises:

[0019] obtaining a third-party target file according to the file name of each target file;

[0020] traversing each class file in each third-party target file and obtaining class-related information of each class file.

[0021] Optionally, the target file of the specified type includes at least one of a third-party class file, a third-party jar file, and a third-party arr file.

[0022] The step of obtaining the target file of the specified type in the target project includes:

[0023] According to the name and type of each file in the target project, a target file of a specified type is obtained.

[0024] Optionally, the class-related information further includes the class name of the class file, all variables, and all methods in the class file.

[0025] In a second aspect, an embodiment of the present application provides an abnormality positioning processing device, which includes:

[0026] A file screening module is configured to obtain a target file of a specified type in the target project through a custom Gradle plug-in, and the target file of the specified type includes at least one of a class file, a jar file, and an arr file.

[0027] A class information obtaining module is configured to traverse each class file in each target file and obtain class-related information of each class file, and the class-related information includes at least an object identifier of an object called by the class file, and the object includes at least one of a method and an interface.

[0028] An abnormality positioning module is configured to obtain a target class file meeting an abnormality positioning condition based on the class-related information of each class file and the abnormality positioning condition configured in the Gradle plug-in, and the abnormality positioning condition includes at least a specified object.

[0029] Optionally, the device further includes:

[0030] A Gradle plug-in creating module is configured to create a custom Gradle plug-in project and create a Gradle plug-in class in the Gradle plug-in project.

[0031] The Transform class creation module is configured to create a Transform class in the Gradle plugin class to obtain target files of a specified type in the project; wherein the Transform class further includes at least target logic code, and the target logic code is executed to traverse each class file in each target file and obtain class-related information of each class file; based on the class-related information of each class file, target class files meeting an exception positioning condition configured in the Gradle plugin are obtained according to the exception positioning condition.

[0032] The Gradle plugin introduction module is configured to introduce the Gradle plugin project into the target project and configure an exception positioning condition for the target project in the Gradle plugin project.

[0033] Optionally, the exception positioning module includes:

[0034] The project packaging processing submodule is configured to package the target project introduced into the Gradle plugin project as an APK to obtain target class-related information meeting the exception positioning condition according to the exception positioning condition configured in the Gradle plugin based on the class-related information of each class file, and output the target class-related information to a specified result file.

[0035] The result reading submodule is configured to obtain the specified result file and locate to a target class file corresponding to each target class-related information.

[0036] Optionally, the class information obtaining module includes:

[0037] The third-party file obtaining submodule is configured to obtain a third-party target file according to a file name of each target file.

[0038] The class information obtaining submodule is configured to traverse each class file in each third-party target file and obtain class-related information of each class file.

[0039] Optionally, the target files of the specified type include at least one of a third-party class file, a third-party jar file, and a third-party arr file.

[0040] The file screening module is specifically configured to:

[0041] obtain target files of a specified type according to the name and type of each file in the target project.

[0042] Optionally, the class-related information further comprises a class name of the class file, all variables in the class file, and all methods.

[0043] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the abnormality positioning processing method according to the first aspect are implemented.

[0044] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, characterized in that the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the abnormality positioning processing method according to the first aspect are implemented.

[0045] In the embodiment of the present application, the class information of a specific object called in an Android project is quickly positioned through a self-defined Gradle plug-in, so that the quick positioning of project abnormalities is realized, and when an online crash occurs, the problem can be quickly positioned and the crash can be repaired. BRIEF DESCRIPTION OF DRAWINGS

[0046] Figure 1 is a step flowchart of an abnormality positioning processing method in an embodiment of the present application;

[0047] Figure 2 is an application crash stack information schematic diagram in an embodiment of the present application;

[0048] Figure 3 is a step flowchart of another abnormality positioning processing method in an embodiment of the present application;

[0049] Figure 4A is an execution flowchart of a self-defined Gradle plug-in in an embodiment of the present application;

[0050] Figure 4B is a flowchart of abnormality positioning for a project through a self-defined Gradle plug-in in an embodiment of the present application;

[0051] Figure 5 is a structure schematic diagram of an abnormality positioning processing device in an embodiment of the present application;

[0052] Figure 6 is a structure schematic diagram of another abnormality positioning processing device in an embodiment of the present application. DETAILED DESCRIPTION

[0053] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are a part rather than all of the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0054] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are a part rather than all of the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application. Figure 1 FIG. 1 shows a step flowchart of an abnormality positioning processing method in an embodiment of the present application.

[0055] In step 110, a self-defined Gradle plug-in is used to obtain target files of a specified type in the target project, wherein the target files of the specified type include at least one of class files, jar files and arr files.

[0056] In step 120, each class file in each target file is traversed, and class-related information of each class file is obtained, wherein the class-related information at least includes object identification of an object called by the class file, and the object includes at least one of a method and an interface.

[0057] In step 130, based on the class-related information of each class file, a target class file meeting an abnormality positioning condition is obtained according to the abnormality positioning condition configured in the Gradle plug-in, wherein the abnormality positioning condition at least includes calling a specified object.

[0058] As described above, in the related art, it can be seen from the application crash stack information collected from the background that the crash problem is generally caused by calling a system-provided method. However, since the third-party aar often uses a third-party hardening function, it is difficult to locate the specific class that calls the system-provided method to cause the crash based on the stack information, and there is no way to search the class in the third-party aar according to the method name, thereby causing the problem to be unable to be located and the crash to be unable to be repaired.

[0059] For example, Figure 2The application crash stack information collected in the background of bugly (a platform for collecting application crash information) is shown. It can be seen from the 5th line that the crash is caused by the onServiceConnected method of a class, and it can be seen from the 4th line that the class calls the system provided unbindService method, but because the three-party hardening function is used, the "Cq" in it is the class name after hardening, not the real class name, so there is no way to directly locate the specific class, and there is no way to search the class in the third-party AAR according to the method name, so the problem cannot be located and the crash cannot be repaired.

[0060] Therefore, in the embodiment of the application, in order to solve the above problems, the ability to quickly obtain the class information of the third-party aar in the project that calls a specific method is provided, and the class that calls a specific method in the third-party aar in the project is searched. The class file can be understood as a file obtained by compiling the java source code. Generally speaking, the source code of a class in the java source code can generate a class file after compilation.

[0061] Specifically, the class file that may call a specific method and cause the project to crash can be traversed by customizing the Gradle plug-in. Gradle is an open source tool for project automation construction based on the concepts of Apache Ant and Apache Maven.

[0062] Moreover, in practical applications, a project can generally include a separate class file, and can also include jar files, arr files, etc. The jar / JAR file is a Java Archive File, as the name implies, its application is closely related to Java, and it is a document format of Java. The jar file generally includes class files and manifest files, but does not include resource files such as images and all files in res. The aar / AAR (Android Archive) package is a binary archive file of an Android library project, and the aar file includes all resources, class and res resource files. Moreover, in the aar file, the class file can be a.jar format data package.

[0063] Therefore, in the embodiment of the present application, according to the requirement of the crash positioning analysis, the target file of the specified type which needs to be acquired can be set to include at least one of class file, jar file and arr file. For example, assuming that the crash positioning processing is performed on the global code of the target project, the target file of the specified type can include class file, jar file and arr file at this time; if the crash positioning processing is performed on the arr file in the target project, the target file of the specified type can only include arr file at this time; if the crash positioning processing is performed on the jar file in the target project, the target file of the specified type can only include jar file at this time.

[0064] In addition, in the case where the target file of the specified type includes class file and jar file, since the arr file contains data packet in.jar format and the class file, the data packet in.jar format contained in the arr file can also be read as a kind of jar file at this time, which is not limited in the embodiment of the present application.

[0065] After the target file of the specified type in the target project is acquired, each class file contained in each of the target files (wherein if the target file of the specified type is class file, each class file in the target file is the target file itself) can be traversed, and the class related information of each class file can be acquired. In order to facilitate the subsequent detection of whether the class file calls the specified system method, the class related information can be set to at least include the object identifier of the object called by the class file as the method name of the method called by the class file. Of course, the class related information can also include class name, variable defined by each line of code in the class file, method and any available information, which is not limited in the embodiment of the present application.

[0066] Furthermore, in the embodiment of the present application, the class related information of each class file can be acquired by any available way, which is not limited in the embodiment of the present application. For example, the class related information of each class file can be read by the class bytecode modification tool ASM.

[0067] Further, the target class file which meets the exception positioning condition from each class file can be acquired based on the class related information of each class file acquired, according to the exception positioning condition configured in the introduced custom Gradle plug-in, wherein the exception positioning condition at least includes calling the specified object.

[0068] In the custom Gradle plug-in, an interface or path for configuring the exception locating condition can be set, and a technical personnel can set the exception locating condition for the target project through the interface or path. The specified method in the exception locating condition can be set according to requirements, and the embodiments of the present application are not limited in this aspect.

[0069] For example, as described above, it can be obtained through analysis that a method provided by a system is generally called to cause a crash, and at this time, the specified method can be set as the method provided by the system, and the like.

[0070] In addition, in the embodiments of the present application, in addition to the crash exception described above, in order to scan whether the project contains an exception of calling an illegal Api (Application Program Interface, application program interface, that is, interface), at this time, the calling object can be an interface, the class related information can include an Api identifier of an Api called by a class file, and the exception locating condition can include calling a specified Api, and the embodiments of the present application are not limited in this aspect.

[0071] Reference Figure 3 In the embodiments of the present application, before the step 110, further comprising:

[0072] Step 210, creating a custom Gradle plug-in project, and creating a Gradle plug-in class in the Gradle plug-in project;

[0073] Step 220, creating a Transform class in the Gradle plug-in class to obtain target files of a specified type in the project; wherein the Transform class further includes at least target logic code, the target logic code is executed to traverse each class file in each target file, and obtains class related information of each class file; based on the class related information of each class file, according to the exception locating condition configured in the Gradle plug-in, target class files meeting the exception locating condition are obtained;

[0074] Step 230, introducing the Gradle plug-in project into the target project, and configuring the exception locating condition for the target project in the Gradle plug-in project.

[0075] In actual application, after the class file is generated and before the dex file is generated, all target files of a specified type in the current application, that is, the target project, are obtained, and then the ASM library is used to traverse all class files in the target files,

[0076] Gradle Transform is a set of standard APIs provided by Android for developers to modify.class files during the project build phase (.class ->.dex conversion). The classic applications are bytecode instrumentation, code injection, etc. Through the Transform API, third parties can operate.class files in the form of plugins during the compilation process before the Android application is packaged into a dex file. Therefore, in the embodiments of the present application, a Transform class can be implemented to obtain target files of a specified type in the project.

[0077] Specifically, a custom Gradle plugin project can be created, and a Gradle plugin class can be created in the custom Gradle plugin project. Further, a Transform class can be created in the Gradle plugin class to obtain target files of a specified type in the project.

[0078] In addition, in order to facilitate the direct acquisition of target class files that meet the abnormal positioning conditions through the custom Gradle plugin project, the corresponding Transform class in the custom Gradle plugin project can also be customized to inject target logic code for executing the above steps 120-130.

[0079] Then, when performing crash positioning on a target project, the corresponding custom Gradle plugin project can be introduced into the target project, and the abnormal positioning conditions for the current target project can be configured in the Gradle plugin project. That is, the custom Gradle plugin is applied in the project or project according to the needs.

[0080] Furthermore, in the embodiments of the present application, the custom Gradle plugin project can be published to the local repository of the platform for crash positioning, so that multiple projects in the platform can be crash positioned by introducing the Gradle plugin project, which is convenient to operate.

[0081] Reference Figure 3 In the embodiments of the present application, the step 130 can further include:

[0082] Step 131, performing apk packaging on the target project that introduces the Gradle plugin project, to obtain target class related information that meets the abnormal positioning conditions based on the class related information of each class file and the abnormal positioning conditions configured in the Gradle plugin, and output to a specified result file.

[0083] Step 132, obtain the specified result file, and locate to the target class file corresponding to each target class related information.

[0084] The target project of the Gradle plug-in project is generally a project or an engineering that is compiled but not packaged into an apk. Then, in order to perform crash positioning through the Gradle plug-in in the target project, the target project in which the Gradle plug-in project is introduced can be packaged into an apk after the Gradle plug-in project is introduced. Then, in the packaging process, the target file of a specified type in the target project can be obtained through the customized Gradle plug-in introduced therein, each class file in each target file can be traversed, and the class related information of each class file can be obtained. Based on the class related information of each class file, the target class related information meeting the exception positioning condition can be obtained according to the exception positioning condition configured in the Gradle plug-in.

[0085] Moreover, in the embodiment of the application, the class related information meeting the exception positioning condition can also be configured in the Gradle plug-in and output to a specified result file. Then, in the process of packaging the target project in which the Gradle plug-in project is introduced into an apk, the target class related information meeting the exception positioning condition can be obtained and output to the specified result file. After the packaging result is executed, the specified result file can be obtained, from which the target class calling the specified object can be obtained, and then the target class file corresponding to each target class related information can also be located. The specific class in which the crash problem occurs can be quickly located, and then repaired according to the cause.

[0086] Optionally, in the embodiment of the application, the step 120 can further include:

[0087] Step 121, obtain the third-party target file according to the file name of each target file;

[0088] Step 122, traverse each class file in each third-party target file, and obtain the class related information of each class file.

[0089] In actual application, the system is relatively stable, and the system itself will not generally crash when calling a specified method provided by the system. The third-party file is not a file of the system itself, and the third-party provided file is more likely to cause a crash when calling a specified object.

[0090] Therefore, in the embodiment of the present application, in order to improve the efficiency, the crash positioning can be performed only on the third-party files in the target project. Moreover, in the actual application, it can be determined according to the file name whether the file is a third-party file or a system file.

[0091] Therefore, in the embodiment of the present application, the target files of the specified type in the target project can be obtained through the self-defined Gradle plug-in, and at this time, it is not distinguished whether the target files are third-party files or system files. When each class file in each target file is traversed subsequently, in order to avoid invalid traversal of the system files, each class file in the third-party target file can be traversed only. Therefore, after the target files of the specified type in the target project are obtained, the third-party target files can be obtained according to the file name of each target file. Of course, in the embodiment of the present application, the third-party files and the system files can also be distinguished through any other available manner, and the embodiment of the present application is not limited in this regard.

[0092] Optionally, in the embodiment of the present application, the target files of the specified type include at least one of the third-party class files, the third-party jar files and the third-party arr files.

[0093] The step 110 can further include obtaining the target files of the specified type according to the name and type of each file in the target project.

[0094] In the embodiment of the present application, the target files of the specified type can also be set as the third-party files in the initial stage, that is, at least one of the third-party class files, the third-party jar files and the third-party arr files.

[0095] Therefore, the specific type of the target files required to be obtained can be set in the self-defined Gradle plug-in, so that the target files of the specified type can be obtained according to the name and type of each file in the target project through the self-defined Gradle plug-in.

[0096] Optionally, in the embodiment of the present application, the class-related information further includes the class name of the class file, all variables (variable name, variable value, etc.) in the class file and all methods (method name, method body, etc.).

[0097] In the embodiment of the present application, all class files and third-party jar files in the project are traversed through the self-defined Gradle plug-in, the class-related information is read using ASM, and the class meeting the condition is output to the specified result file according to the plug-in configuration.

[0098] Specific schemes can include the following steps:

[0099] Specific scheme steps:

[0100] 1. Create a custom Gradle plugin project;

[0101] 2. Create a custom Gradle plugin class, create a custom Transform class;

[0102] 3. Get all jar and class file sets in the project in the custom Transform class;

[0103] 4. Traverse all jar and class file sets in the project, and use ASM to obtain class-related information of the class file;

[0104] 5. According to the plugin configuration, the class-related information that meets the conditions, including class name, all fields (variable name, variable value, etc.) and Method (method name, method body, etc.), is output to the specified result file;

[0105] 6. Publish the custom Gradle plugin to the local repository;

[0106] 7. Apply the custom Gradle plugin in the application project and configure as needed;

[0107] 8. Execute the package to obtain the result file;

[0108] Through the above steps, the specific class that causes the crash problem can be quickly located, and then the reason is repaired.

[0109] As shown in Figure 4A is an execution flow diagram of a custom Gradle plugin, and as shown in Figure 4B is a flow diagram of an exception positioning process for a project through a custom Gradle plugin.

[0110] In the embodiment of the application, the class information of the class calling a specific method in the third-party aar in the Android project is quickly located through the custom gradle plugin using ASM, so that when an online crash occurs, the problem can be quickly located and the crash can be repaired. In addition, it can also be used to scan whether the project contains a call to an illegal API.

[0111] Referring to Figure 5 , a structure diagram of an exception positioning processing apparatus in the embodiment of the application is shown.

[0112] The exception positioning processing apparatus in the embodiment of the application comprises a file screening module 310, a class information obtaining module 320, and an exception positioning module 330.

[0113] The functions of each module and the interaction relationship between the modules are described in detail as follows.

[0114] The file screening module 310 is configured to obtain target files of a specified type in the target project through a custom Gradle plug-in, the target files of the specified type including at least one of class files, jar files and arr files.

[0115] The class information obtaining module 320 is configured to traverse each class file in each target file and obtain class-related information of each class file, the class-related information including at least an object identifier of an object called by the class file, the object including at least one of a method and an interface.

[0116] The exception positioning module 330 is configured to obtain target class files meeting an exception positioning condition based on the class-related information of each class file and the exception positioning condition configured in the Gradle plug-in, the exception positioning condition including at least a specified object.

[0117] With reference to Figure 6 In the embodiment of the application, the device can further include:

[0118] The Gradle plug-in creating module 410 is configured to create a custom Gradle plug-in project and create a Gradle plug-in class in the Gradle plug-in project.

[0119] The Transform class creating module 420 is configured to create a Transform class in the Gradle plug-in class to obtain target files of a specified type in the project, the Transform class including at least target logic code, the target logic code being executed to traverse each class file in each target file and obtain class-related information of each class file, and the Transform class being configured to obtain target class files meeting an exception positioning condition based on the class-related information of each class file and the exception positioning condition configured in the Gradle plug-in.

[0120] The Gradle plug-in introducing module 430 is configured to introduce the Gradle plug-in project into the target project and configure an exception positioning condition for the target project in the Gradle plug-in project.

[0121] With reference to Figure 6 In the embodiment of the application, the exception positioning module 330 can include:

[0122] The engineering packaging processing submodule 331 is configured to perform APK packaging on the target engineering introduced into the Gradle plug-in engineering, to obtain target class-related information meeting an abnormal positioning condition based on class-related information of each class file and according to the abnormal positioning condition configured in the Gradle plug-in, and output the target class-related information into a specified result file.

[0123] The result reading submodule 332 is configured to obtain the specified result file and locate to a target class file corresponding to each target class-related information.

[0124] Optionally, in the embodiment of the present application, the class information obtaining module 320 can comprise:

[0125] The third-party file obtaining submodule is configured to obtain a third-party target file according to a file name of each target file.

[0126] The class information obtaining submodule is configured to traverse each class file in each third-party target file and obtain class-related information of each class file.

[0127] Optionally, in the embodiment of the present application, the target file of the specified type comprises at least one of a third-party class file, a third-party jar file and a third-party arr file.

[0128] The file screening module 310 can be specifically configured to:

[0129] obtain a target file of a specified type according to a name and a type of each file in the target engineering.

[0130] Optionally, in the embodiment of the present application, the class-related information further comprises a class name of the class file, all variables in the class file and all methods.

[0131] The abnormal positioning processing device provided in the embodiment of the present application can realize each process realized in the method embodiment, and thus repeated description is omitted here. Figures 1-2 The method embodiment, and thus repeated description is omitted here.

[0132] Preferably, the embodiment of the present application further provides an electronic device comprising a processor, a memory, a computer program stored on the memory and executable on the processor, the computer program being executed by the processor to realize each process of the above abnormal positioning processing method embodiment and achieve the same technical effect, and thus repeated description is omitted here.

[0133] The embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program.

[0134] It should be noted that, in this document, the terms "comprising", "including", or any other variant thereof are intended to cover a non-exclusive inclusion, such that processes, methods, articles, or apparatuses that comprise a list of elements not only include those elements, but also include other elements not expressly listed or inherent to such processes, methods, articles, or apparatuses. Without more limitations, an element defined by the statement "including a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0135] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platforms, and of course, they can also be realized by hardware, but in many cases, the former is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present application.

[0136] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above specific embodiments, and the above specific embodiments are only illustrative, not restrictive. Those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope of protection of the claims, and all of them belong to the protection of the present application.

[0137] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solutions. Professional technicians can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0138] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

[0139] In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other manners. For example, the apparatus embodiments described above are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0140] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0141] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0142] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk and various program code storage media.

[0143] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An abnormality positioning processing method characterized by comprising: The application comprises: obtaining target files of a specified type in a target project through a self-defined Gradle plug-in, the target files of the specified type including at least one of class files, jar files and arr files; traversing each class file in each target file and obtaining class-related information of each class file, the class-related information including at least object identification of an object called by the class file, the object including at least one of a method and an interface; based on the class-related information of each class file, obtaining target class files meeting an exception positioning condition configured in the Gradle plug-in according to the exception positioning condition, the exception positioning condition including at least a specified object, the specified object including a method causing a crash; wherein, before the step of obtaining the target files of the specified type in the target project through the self-defined Gradle plug-in, the application further comprises: creating a self-defined Gradle plug-in project and creating a Gradle plug-in class in the Gradle plug-in project; creating a Transform class in the Gradle plug-in class to obtain target files of a specified type in the project; the Transform class further including at least target logic code, the target logic code being executed to traverse each class file in each target file and obtain class-related information of each class file; performing apk packaging on a target project introducing the Gradle plug-in project to obtain target class-related information meeting an exception positioning condition configured in the Gradle plug-in based on the class-related information of each class file according to the exception positioning condition, and outputting the target class-related information to a specified result file; obtaining the specified result file and positioning to a target class file corresponding to each target class-related information; introducing the Gradle plug-in project into the target project and configuring the exception positioning condition for the target project in the Gradle plug-in project.

2. The method of claim 1, wherein, The step of traversing each class file in each target file and obtaining class-related information of each class file comprises: obtaining third-party target files according to file names of each target file; traversing each class file in each third-party target file and obtaining class-related information of each class file.

3. The method of claim 1, wherein, The target files of the specified type include at least one of third-party class files, third-party jar files and third-party arr files; The step of obtaining the target files of the specified type in the target project comprises: obtaining target files of a specified type according to names and types of each file in the target project.

4. The method of claim 1, wherein, The class-related information further includes a class name of the class file, all variables in the class file, and all methods.

5. An abnormality positioning processing apparatus characterized by comprising: The method comprises the following steps: A file screening module is configured to obtain target files of a specified type in a target project through a custom Gradle plug-in, wherein the target files of the specified type include at least one of a class file, a jar file, and an arr file. A class information acquisition module is configured to traverse each class file in each target file and acquire class-related information of each class file, wherein the class-related information at least includes an object identifier of an object called by the class file, and the object includes at least one of a method and an interface. An exception positioning module is configured to acquire target class files that meet an exception positioning condition based on the class-related information of each class file and the exception positioning condition configured in the Gradle plug-in, wherein the exception positioning condition at least includes a specified object, and the specified object includes a method that is called and causes a crash. The device further comprises: A Gradle plug-in creation module is configured to create a custom Gradle plug-in project and create a Gradle plug-in class in the Gradle plug-in project. A Transform class creation module is configured to create a Transform class in the Gradle plug-in class to acquire target files of a specified type in a project, wherein the Transform class at least further includes target logic code, and the target logic code is executed to traverse each class file in each target file and acquire class-related information of each class file, and acquire target class files that meet an exception positioning condition based on the class-related information of each class file and the exception positioning condition configured in the Gradle plug-in. A Gradle plug-in introduction module is configured to introduce the Gradle plug-in project into the target project and configure an exception positioning condition for the target project in the Gradle plug-in project. The exception positioning module comprises: An engineering packaging processing submodule is configured to package an apk of a target project that introduces the Gradle plug-in project to acquire target class-related information that meets an exception positioning condition based on class-related information of each class file and the exception positioning condition configured in the Gradle plug-in, and output the target class-related information to a specified result file. A result reading submodule is configured to acquire the specified result file and position to a target class file corresponding to each target class-related information.

6. The apparatus of claim 5, wherein, The class information acquisition module comprises: A third-party file acquisition submodule is configured to acquire a third-party target file according to a file name of each target file. The class information obtaining submodule is configured to traverse each class file in each third-party target file and obtain class-related information of each class file.

7. The apparatus of claim 5, wherein, The target file of the specified type includes at least one of a third-party class file, a third-party jar file and a third-party arr file. The file screening module is specifically configured to: According to the name and type of each file in the target project, the target file of the specified type is obtained.

8. The apparatus of claim 5, wherein, The class-related information further includes the class name of the class file, all variables and all methods in the class file.

9. An electronic device, comprising: The computer program is stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the abnormal positioning processing method in any one of claims 1 to 4 are implemented. The computer program is stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the abnormal positioning processing method in any one of claims 1 to 4 are implemented.

10. A computer-readable storage medium, characterized in that, ​

Citation Information

Patent Citations

  • Routing verification method, device and equipment and storage medium

    CN111767094A

  • Compiling detection method and device, equipment and storage medium

    CN112748930A