An Android application compatibility problem fixing method, device, equipment and medium

By obtaining the Android application installation package and utilizing the template for problem location and repair blocks, compatibility issues with released applications were resolved, improving the user experience.

CN115525457BActive Publication Date: 2026-04-24HANGZHOU DBAPPSECURITY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU DBAPPSECURITY CO LTD
Filing Date
2022-09-15
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing technologies cannot effectively fix compatibility issues of released Android applications, resulting in a very poor user experience.

Method used

By obtaining the Android application installation package, using a template that includes problem location and repair blocks, the installation package is traversed and problems are repaired. Soot is used to convert the bytecode into Jimple code for analysis and repair.

Benefits of technology

It has fixed compatibility issues for released Android applications, improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115525457B_ABST
    Figure CN115525457B_ABST
Patent Text Reader

Abstract

The application discloses an Android application compatibility problem repairing method and device, equipment and medium, including: obtaining an Android application installation package; obtaining a template; the template includes a problem positioning block and a repairing block; the problem positioning block includes conditions required to be met for the existence of compatibility problems; the template is used to traverse the Android application installation package, and if a problem is located based on the problem positioning block during the traversal process, the repairing block is used to repair the problem. In this way, for the Android application installation package, the problem is located and repaired through the template including the problem positioning block and the repairing block, the compatibility problem of the published Android application can be repaired, and thus the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Android application problem repair technology, and in particular to a method, apparatus, device and medium for repairing Android application compatibility problems. Background Technology

[0002] Android is an open-source and free operating system based on Linux. These two characteristics give phone manufacturers the opportunity to modify and customize it. Since different manufacturers use different hardware devices, they inevitably make secondary modifications to the Android system, leading to the first type of fragmentation problem: device compatibility issues. Furthermore, different versions of Android run on different models, leading to a second type of fragmentation problem: SDK (Software Development Kit) compatibility issues. These compatibility issues often cause some applications to fail to install or start, or cause the program to crash when using certain functions. In addition, many older versions of Android are no longer supported by Google, making it difficult for phones running these systems to enjoy the latest applications.

[0003] Currently, existing technologies typically focus on fixing the source code of Android applications, and therefore cannot be used with already released apps. Over time, many Android apps released on app stores will result in a very poor user experience if compatibility issues are not fixed in a timely manner. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a method, apparatus, device, and medium for fixing compatibility issues in Android applications, which can fix compatibility issues in released Android applications, thereby improving the user experience. The specific solution is as follows:

[0005] Firstly, this application discloses a method for fixing Android application compatibility issues, including:

[0006] Obtain the Android application installation package;

[0007] Obtain a template; the template includes a problem location block and a repair block; the problem location block includes the conditions that must be met for a compatibility issue to exist;

[0008] The template is used to traverse the Android application installation package. If a problem is located based on the problem location block during the traversal, the repair block is used to repair the problem.

[0009] Optionally, after obtaining the template, the process further includes:

[0010] The template is parsed into a semantic object;

[0011] Accordingly, the step of traversing the Android application installation package using the template includes: traversing the Android application installation package using the semantic object.

[0012] Optionally, after obtaining the Android application installation package, the process further includes:

[0013] The Android application installation package is converted into intermediate code of a preset format; the preset format is the code format used by the template.

[0014] Accordingly, the step of traversing the Android application installation package using the template includes: traversing the intermediate code of the Android application installation package using the template.

[0015] Optionally, converting the Android application installation package into intermediate code of a preset format includes:

[0016] The Android application installation package is converted into intermediate code of a preset format using soot.

[0017] Optionally, the preset format is a Jimple, Baf, Shimple, or Grimple code format.

[0018] Optional, also includes:

[0019] After the traversal is complete, the intermediate code is converted into bytecode and saved as an Android application installation package.

[0020] Optionally, the template further includes a variable block; if a problem is located based on the problem location block during traversal, then the problem is fixed using the repair block, including:

[0021] If the problem function is located based on the problem location block during the traversal, then the variable block is parsed;

[0022] If a custom variable exists in the variable block, and the custom variable is a function internal variable, then the first variable definition corresponding to the function internal variable is found from the problematic function using soot, and the first variable definition is replaced by the second variable definition corresponding to the function internal variable in the repair block;

[0023] If a custom variable exists in the variable block, and the custom variable is a variable to be searched, then the third variable definition corresponding to the variable to be searched is searched from the context of the problem function using soot, and the third variable definition is replaced by the fourth variable definition corresponding to the variable to be searched in the repair block.

[0024] If the variable block contains a variable from the original kernel code, then the definition of that variable in the Android application installation package is replaced based on the problematic function and the fix block.

[0025] Secondly, this application discloses an Android application compatibility issue repair device, comprising:

[0026] The installation package acquisition module is used to obtain Android application installation packages;

[0027] A template acquisition module is used to acquire templates; the templates include problem location blocks and repair blocks; the problem location blocks include the conditions that need to be met for compatibility issues to exist;

[0028] The problem traversal module is used to traverse the Android application installation package using the template. If a problem is located based on the problem location block during the traversal, the problem is fixed using the repair block.

[0029] Thirdly, this application discloses an electronic device, including a memory and a processor, wherein:

[0030] The memory is used to store computer programs;

[0031] The processor is used to execute the computer program to implement the aforementioned method for fixing Android application compatibility issues.

[0032] Fourthly, this application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned method for fixing Android application compatibility issues.

[0033] As can be seen, this application obtains an Android application installation package and a template; the template includes a problem location block and a repair block; the problem location block includes the conditions that must be met for a compatibility issue to exist. Then, the template is used to traverse the Android application installation package. If a problem is located based on the problem location block during the traversal, the repair block is used to fix the problem. In other words, this application, targeting Android application installation packages, uses a template including a problem location block and a repair block to locate and repair problems, enabling the repair of compatibility issues in released Android applications, thereby improving the user experience. Attached Figure Description

[0034] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0035] Figure 1 This application discloses a flowchart of a method for fixing Android application compatibility issues.

[0036] Figure 2 This application discloses a flowchart of a specific method for fixing Android application compatibility issues.

[0037] Figure 3 This is a schematic diagram of the structure of an Android application compatibility problem repair device disclosed in this application;

[0038] Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation

[0039] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0040] Currently, to address Android system compatibility issues, existing technologies typically involve obtaining updated source code from open-source Android applications or Google's update releases, formatting it into a standard structure (to prevent unfixable issues caused by source code differences), and analyzing the values ​​of all variables in the target application through data stream analysis to prevent variables from being null after the update. Then, the source code of the target application is searched and repaired. Existing technologies generally focus on repairing the source code of Android applications, and therefore cannot be used for already released applications. Over time, many Android applications released in app stores, if compatibility issues are not addressed in a timely manner, will result in a very poor user experience. Therefore, this application provides an Android application compatibility issue repair solution that can fix compatibility issues in released Android applications, thereby improving the user experience.

[0041] join Figure 1 As shown in the figure, this application discloses a method for fixing Android application compatibility issues, including:

[0042] Step S11: Obtain the Android application installation package (APK).

[0043] In one implementation, the Android application installation package can be converted into intermediate code of a preset format; the preset format is the code format adopted by the template.

[0044] Furthermore, embodiments of this application can utilize soot to convert the Android application installation package into intermediate code of a preset format. The preset format is either Jimple, Baf, Shimple, or Grimple code format. For example, Soot can be used to convert the Dalvik bytecode of the Android application installation package into Jimple code.

[0045] Soot is a Java analysis and optimization framework that converts bytecode into intermediate code for analysis and optimization. Dalvik is the Android virtual machine used to run Java applications on Linux. Bytecode: Code used by the virtual machine for identification. Jimple: A 3-address intermediate code used by the Soot framework. BAF is a simplified bytecode representation, Shimple is a variant of Jimple, and Grimple is a compilation of Jimple for decompilation and code inspection. Linux: An operating system.

[0046] Step S12: Obtain a template; the template includes a problem location block and a repair block; the problem location block includes the conditions that need to be met for the existence of compatibility issues.

[0047] In a specific implementation, multiple templates can be obtained, each corresponding to a compatibility issue. It is understood that multiple templates can be pre-created, and these pre-created templates can be loaded during issue fixing.

[0048] Step S13: Use the template to traverse the Android application installation package. If a problem is located based on the problem location block during the traversal, use the repair block to repair the problem.

[0049] In one implementation, the template can be used to traverse the intermediate code of the Android application installation package.

[0050] Furthermore, in this embodiment, after obtaining the template, the template can be parsed into a semantic object, and the semantic object can be used to traverse the Android application installation package. Parsing into a semantic object means parsing the template into a specific structure through code.

[0051] Furthermore, in this embodiment of the application, the semantic object is used to traverse the intermediate code of the Android application installation package.

[0052] Furthermore, in this embodiment of the application, the semantic object is used to traverse each function of each class in the intermediate code of the Android application installation package.

[0053] Furthermore, the template also includes a variable block; correspondingly, if a problem is located based on the problem location block during traversal, then the problem is fixed using the repair block, including:

[0054] If the problem function is located based on the problem location block during the traversal, then the variable block is parsed;

[0055] If a custom variable exists in the variable block, and the custom variable is a function internal variable, then the first variable definition corresponding to the function internal variable is found from the problematic function using soot, and the first variable definition is replaced by the second variable definition corresponding to the function internal variable in the repair block;

[0056] If a custom variable exists in the variable block, and the custom variable is a variable to be searched, then the third variable definition corresponding to the variable to be searched is searched from the context of the problem function using soot, and the third variable definition is replaced by the fourth variable definition corresponding to the variable to be searched in the repair block.

[0057] If the variable block contains a variable from the original kernel code, then the definition of that variable in the Android application installation package is replaced based on the problematic function and the fix block.

[0058] Understandably, custom variables are variables defined by programmers when implementing Android applications. Variables in the original kernel code include both internal and external function variables; these are part of the Android kernel code, and their definition locations can be specified in the template. Furthermore, because the template is converted into a semantic object during iteration, the repair block needs to be constructed into intermediate code of the appropriate format before replacement.

[0059] Furthermore, after the traversal is complete, the intermediate code is converted into bytecode and saved as an Android application installation package.

[0060] To address application compatibility issues caused by the severe fragmentation of the Android ecosystem, such as crashes due to Android SDK version differences or specific device limitations, this application provides an Android compatibility issue remediation solution. This solution addresses compatibility issues in released applications. Taking Jimpile code as an example, the specific steps include: 1) creating a corresponding template for the compatibility issue and then parsing the template into a semantic object; 2) converting the target application's Dalvik bytecode into Jimpile code using Soot; 3) traversing the target application's Jimpile code and locating the problem location using the semantic object; 4) replacing the Jimpile code with the semantic object; and 5) restoring the Jimpile code back to Dalvik bytecode using Soot. Further details can be found in [link to relevant documentation]. Figure 2 As shown in the figure, this application discloses a flowchart of a specific method for fixing Android compatibility issues:

[0061] The first step is to convert the input target APK into Jimple code using Soot;

[0062] The second step is to load the template and convert it into a semantic object. The template is in Jimpile code format and consists of three parts: the first part is the variable block, which contains user-defined variables and variables included in the original code. User-defined variables include variables inside functions and variables that need to be searched in context, such as variables declared outside functions that the function needs to use; the second part is the problem location block, which is used to locate the problematic function and the conditions that the problem must meet; the third part is the repair block, which is used by professionals to convert the repaired Java code into Jimpile code representation using Soot.

[0063] The third step is to iterate through every function of every class in the target application's Jimpple code and determine whether a problem exists using the problem locator block in the template; if a problem exists, proceed to the fourth step.

[0064] The fourth step is to parse the variable block of the template. If a user-defined variable exists and is a variable inside a function, the corresponding definition is found using Soot. If a user-defined variable exists and is the variable to be searched, Soot is used to search in the context. If the search fails, proceed to the third step; otherwise, proceed to the fifth step.

[0065] The fifth step is to construct the semantic object. After the template is parsed into a semantic object by Soot, the repair block is generated to generate Jimple code, which replaces the original Jimple code of the target application. It is then determined whether the traversal is complete. If not, proceed to the third step; otherwise, proceed to the sixth step.

[0066] Step 6: Use Soot to convert the Jimple code into bytecode and save it as an APK file.

[0067] This approach addresses compatibility issues in released Android applications. Many Android applications on app stores suffer from numerous compatibility problems due to variations in Android version iterations and different hardware models from different manufacturers. Existing technologies typically repair the source code, failing to fix already released applications and offering only specific fixes without good scalability. This application employs a Soot-based bytecode to Jimpile code conversion method, followed by Jimpile code repair and then bytecode conversion. It generates corresponding templates for existing compatibility issues, each designed with three parts: a variable block, a problem block, and a repair block. Each template corresponds to a specific compatibility problem, allowing for the repair of Jimpile code through templates, thus covering a broad range of compatibility issues.

[0068] As can be seen, this application embodiment obtains an Android application installation package and a template; the template includes a problem location block and a repair block; the problem location block includes the conditions that must be met for a compatibility problem to exist. Then, the template is used to traverse the Android application installation package. If a problem is located based on the problem location block during the traversal, the repair block is used to fix the problem. That is, this application embodiment, for Android application installation packages, uses a template including a problem location block and a repair block to locate and repair problems, enabling compatibility issues in released Android applications to be fixed, thereby improving the user experience.

[0069] See Figure 3 As shown in the figure, this application discloses an Android application compatibility problem repair device, including:

[0070] The installation package acquisition module 11 is used to acquire Android application installation packages;

[0071] Template acquisition module 12 is used to acquire templates; the templates include problem location blocks and repair blocks; the problem location blocks include the conditions that need to be met for compatibility issues to exist;

[0072] Problem traversal module 13 is used to traverse the Android application installation package using the template. If a problem is located based on the problem location block during the traversal, the problem is repaired using the repair block.

[0073] As can be seen, this application embodiment obtains an Android application installation package and a template; the template includes a problem location block and a repair block; the problem location block includes the conditions that must be met for a compatibility problem to exist. Then, the template is used to traverse the Android application installation package. If a problem is located based on the problem location block during the traversal, the repair block is used to fix the problem. That is, this application embodiment, for Android application installation packages, uses a template including a problem location block and a repair block to locate and repair problems, enabling compatibility issues in released Android applications to be fixed, thereby improving the user experience.

[0074] Furthermore, the device also includes a template parsing module for parsing the template into a semantic object;

[0075] Correspondingly, the problem traversal module 13 is specifically used to traverse the Android application installation package using the semantic object.

[0076] Furthermore, the device also includes an intermediate code conversion module, used to convert the Android application installation package into intermediate code of a preset format; the preset format is the code format adopted by the template;

[0077] Correspondingly, the problem traversal module 13 is specifically used to traverse the intermediate code of the Android application installation package using the template.

[0078] In one implementation, the intermediate code conversion module is specifically used to convert the Android application installation package into an intermediate code of a preset format using soot.

[0079] The preset format is either Jimple, Baf, Shimple, or Grimple code format.

[0080] Furthermore, the device also includes an Android application installation package generation module, which converts the intermediate code into bytecode and saves it as an Android application installation package after the traversal is completed.

[0081] In one implementation, the template further includes a variable block; the problem traversal module 13 is specifically used for:

[0082] If the problem function is located based on the problem location block during the traversal, then the variable block is parsed;

[0083] If a custom variable exists in the variable block, and the custom variable is a function internal variable, then the first variable definition corresponding to the function internal variable is found from the problematic function using soot, and the first variable definition is replaced by the second variable definition corresponding to the function internal variable in the repair block;

[0084] If a custom variable exists in the variable block, and the custom variable is a variable to be searched, then the third variable definition corresponding to the variable to be searched is searched from the context of the problem function using soot, and the third variable definition is replaced by the fourth variable definition corresponding to the variable to be searched in the repair block.

[0085] If the variable block contains a variable from the original kernel code, then the definition of that variable in the Android application installation package is replaced based on the problematic function and the fix block.

[0086] See Figure 4 As shown in the figure, this application discloses an electronic device 20, including a processor 21 and a memory 22; wherein, the memory 22 is used to store a computer program; the processor 21 is used to execute the computer program, the Android application compatibility problem repair method disclosed in the foregoing embodiment.

[0087] For details on the methods for fixing the aforementioned Android application compatibility issues, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0088] Furthermore, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, and the storage method can be temporary storage or permanent storage.

[0089] In addition, the electronic device 20 also includes a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26; wherein, the power supply 23 is used to provide operating voltage for the various hardware devices on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0090] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the Android application compatibility problem repair method disclosed in the foregoing embodiments.

[0091] For details on the methods for fixing the aforementioned Android application compatibility issues, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0092] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0093] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0094] The above provides a detailed description of the method, apparatus, device, and medium for fixing Android application compatibility issues. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for fixing compatibility issues in Android applications, characterized in that, include: Obtain the Android application installation package; Get template; The template includes a problem location block and a repair block; the problem location block includes the conditions that need to be met for a compatibility problem to exist; The template is used to traverse the Android application installation package. If a problem is located based on the problem location block during the traversal, the repair block is used to repair the problem. The template also includes a variable block; if a problem is located based on the problem location block during traversal, the problem is repaired using the repair block, including: If the problem function is located based on the problem location block during the traversal, then the variable block is parsed; If a custom variable exists in the variable block, and the custom variable is a function internal variable, then the first variable definition corresponding to the function internal variable is found from the problematic function using soot, and the first variable definition is replaced by the second variable definition corresponding to the function internal variable in the repair block; If a custom variable exists in the variable block, and the custom variable is a variable to be searched, then the third variable definition corresponding to the variable to be searched is searched from the context of the problem function using soot, and the third variable definition is replaced by the fourth variable definition corresponding to the variable to be searched in the repair block.

2. The method for fixing Android application compatibility issues according to claim 1, characterized in that, After obtaining the template, the process also includes: The template is parsed into a semantic object; Accordingly, the step of traversing the Android application installation package using the template includes: traversing the Android application installation package using the semantic object.

3. The method for fixing Android application compatibility issues according to claim 1, characterized in that, After obtaining the Android application installation package, the process also includes: The Android application installation package is converted into intermediate code of a preset format; the preset format is the code format used by the template. Accordingly, the step of traversing the Android application installation package using the template includes: traversing the intermediate code of the Android application installation package using the template.

4. The method for fixing Android application compatibility issues according to claim 3, characterized in that, The step of converting the Android application installation package into intermediate code of a preset format includes: The Android application installation package is converted into intermediate code of a preset format using soot.

5. The method for fixing Android application compatibility issues according to claim 3, characterized in that, The preset format is Jimple, Baf, Shimple, or Grimple code format.

6. The method for fixing Android application compatibility issues according to claim 3, characterized in that, Also includes: After the traversal is complete, the intermediate code is converted into bytecode and saved as an Android application installation package.

7. The method for fixing Android application compatibility issues according to any one of claims 1 to 6, characterized in that, If the problem function is located based on the problem location block during the traversal, then after parsing the variable block, the following steps are also included: If the variable block contains a variable from the original kernel code, then the definition of that variable in the Android application installation package is replaced based on the problematic function and the fix block.

8. A device for repairing Android application compatibility issues, characterized in that, include: The installation package acquisition module is used to obtain Android application installation packages; The template retrieval module is used to retrieve templates; The template includes a problem location block and a repair block; the problem location block includes the conditions that need to be met for a compatibility problem to exist; The problem traversal module is used to traverse the Android application installation package using the template. If a problem is located based on the problem location block during the traversal, the problem is fixed using the repair block. The template also includes a variable block; if a problem is located based on the problem location block during traversal, the problem is repaired using the repair block, including: If the problem function is located based on the problem location block during the traversal, then the variable block is parsed; If a custom variable exists in the variable block, and the custom variable is a function internal variable, then the first variable definition corresponding to the function internal variable is found from the problematic function using soot, and the first variable definition is replaced by the second variable definition corresponding to the function internal variable in the repair block; If a custom variable exists in the variable block, and the custom variable is a variable to be searched, then the third variable definition corresponding to the variable to be searched is searched from the context of the problem function using soot, and the third variable definition is replaced by the fourth variable definition corresponding to the variable to be searched in the repair block.

9. An electronic device, characterized in that, Includes memory and processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program to implement the Android application compatibility issue repair method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the Android application compatibility problem repair method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for analyzing and detecting service use defects in Android application

    CN110750439A

  • Code quality control method, system, device and storage medium

    CN111722998A