APK file fusion method, device, equipment and medium

By generating and integrating multiple APK files and judging compatibility with version information and code features, the problems of APK file module division and function maintenance are solved, and efficient maintenance and compatibility of the application is achieved, and resource waste is avoided.

CN118363649BActive Publication Date: 2024-11-26GUANGZHOU YIHU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410375373.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2024-11-26
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

The existing technology is difficult to realize module division and function maintenance of APK files in applications, resulting in excessive application packages, difficulty in transmission and incompatibility, affecting maintenance efficiency and user experience.

Method used

By generating multiple APK files, judging compatibility through version information and code characteristics, selecting compatible APK files for fusion, and using fusion scripts to achieve optional functions and independent compilation.

Benefits of technology

It realizes the integration of multiple APK files of the same application, supports independent maintenance and compilation of different functions, avoids resource waste, and improves application compatibility and maintenance efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363649B_ABST
    Figure CN118363649B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and medium for fusing APK files, and the present application belongs to the field of computer technology. The method includes: generating at least two APK files through at least two projects; wherein each project generates an APK file; reading the version information of the at least two APK files; determining the compatibility between the at least two APK files according to the version information; determining the APK file with compatibility as the candidate APK file; in response to the selection operation, determining the target APK file from the candidate APK file; performing a fusion operation on the target APK file through a fusion script to obtain a fusion result. The present technical solution can generate multiple APK files of the same application for fusion, which is conducive to independent maintenance and independent compilation for different functions, and realizes function selectability when fusing APK files to avoid waste of resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and specifically relates to a method, device, equipment and medium for merging APK files. Background Art

[0002] In application distribution, the APK file of the application needs to be provided for users to download and install.

[0003] At present, most manufacturers only provide a total APK file for the application, which not only makes it difficult to divide modules and maintain functions, but also leads to problems such as the application package being too large, making transmission difficult, and APK file incompatibility, resulting in the application functions not being able to run normally. These problems affect the maintenance efficiency of the application and the user experience.

[0004] Therefore, how to realize the generation and integration of multiple APK files in an application is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a method, device, equipment and medium for fusing APK files, which can generate multiple APK files of the same application for fusion, which is conducive to independent maintenance and independent compilation of different functions, and realizes function selectability when fusing APK files to avoid waste of resources.

[0006] In a first aspect, an embodiment of the present application provides a method for fusing APK files, the method comprising:

[0007] Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0008] Reading version information of the at least two APK files;

[0009] Determine the compatibility between the at least two APK files according to the version information;

[0010] Determine the compatible APK files as candidate APK files;

[0011] In response to a selection operation, determining a target APK file from the candidate APK files;

[0012] The target APK file is fused by a fusion script to obtain a fusion result.

[0013] Further, determining the compatibility between the at least two APK files according to the version information includes:

[0014] Identifying whether the at least two APK files include a main APK file;

[0015] If included, obtain the version number of the main APK file and the version number of the auxiliary APK file of the application;

[0016] When the version number of the main APK file meets the lowest version compatible with the version number of the subsidiary APK file, it is determined that the main APK file and the subsidiary APK file are compatible.

[0017] Further, after generating at least two APK files through at least two projects, the method further includes:

[0018] Get the code characteristics of each APK file;

[0019] The compatibility between the at least two APK files is determined based on the code features.

[0020] Furthermore, the code features of each APK file are obtained, including:

[0021] Decompile the code of each APK file to obtain the code content of each APK file;

[0022] The code content of each APK file is parsed to obtain code features.

[0023] Further, determining the compatibility between the at least two APK files according to the code features includes:

[0024] When it is identified that one or more APK files have code features that include call method deletion or call method change features, it is determined that the APK file is not compatible with other APK files.

[0025] Further, determining the compatibility between the at least two APK files according to the code features includes:

[0026] When it is identified that at least two APK files have the same calling method in their code features, the calling method versions are different, and there is incompatibility between the different calling method versions, it is determined that the at least two APK files are incompatible.

[0027] Further, in response to the selection operation, determining the target APK file from the candidate APK files includes:

[0028] Obtaining deployment information of the application; wherein the deployment information includes at least one of deployment region information, deployment object information, and deployment method information;

[0029] A candidate APK file to be used is determined as a target APK file according to the deployment information.

[0030] In a second aspect, an embodiment of the present application provides a device for fusing APK files, the device comprising:

[0031] An APK file generation module, used to generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0032] A version information reading module, used to read the version information of the at least two APK files;

[0033] A compatibility determination module, configured to determine the compatibility between the at least two APK files according to the version information;

[0034] A candidate file determination module, used to determine compatible APK files as candidate APK files;

[0035] A target file determination module, for responding to a selection operation, determining a target file from the candidate APK files, and selecting the required APK to be merged into an application package and released to the market, which is beneficial for targeting different target APK files;

[0036] The APK file fusion module is used to perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0037] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0038] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0039] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0040] In an embodiment of the present application, at least two APK files are generated by at least two projects; wherein each project generates an APK file; the version information of the at least two APK files is read; the compatibility between the at least two APK files is determined according to the version information; the APK file with compatibility is determined as a candidate APK file; in response to a selection operation, a target APK file is determined from the candidate APK files; a fusion operation is performed on the target APK file through a fusion script to obtain a fusion result. Through the above-mentioned APK file fusion method, multiple APK files of the same application can be generated for fusion, which is conducive to independent maintenance and independent compilation for different functions, and function selectability is realized when fusion APK files are merged to avoid resource waste. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a flowchart of a method for fusing APK files provided in Example 1 of the present application;

[0042] Figure 2 This is a schematic diagram of APK file fusion provided in Example 1 of the present application;

[0043] Figure 3 It is a flowchart of a method for fusing APK files provided in Embodiment 2 of the present application;

[0044] Figure 4 It is a flowchart of a method for fusing APK files provided in Embodiment 3 of the present application;

[0045] Figure 5 It is a flowchart of a method for fusing APK files provided in Embodiment 4 of the present application;

[0046] Figure 6 This is a flowchart of a method for fusing APK files provided in Embodiment 5 of the present application;

[0047] Figure 7 This is a flowchart of a method for fusing APK files provided in Example 6 of the present application;

[0048] Figure 8 It is a flowchart of a method for fusing APK files provided in Embodiment 7 of the present application;

[0049] Fig. 9 This is a schematic diagram of the structure of an APK file fusion device provided in Embodiment 8 of the present application;

[0050] Fig.10 It is a structural diagram of an electronic device provided in Example 9 of the present application. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all of the content is shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0052] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0053] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0054] In the following, in conjunction with the accompanying drawings, a method, device, equipment and medium for merging APK files provided in an embodiment of the present application are described in detail through specific embodiments and their application scenarios.

[0055] Embodiment 1

[0056] Figure 1 1 is a flow chart of a method for fusing APK files provided in Example 1 of the present application. Figure 1 As shown, the specific steps include:

[0057] S101. Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0058] The application scenario of this solution may be a scenario of fusing APK files.

[0059] Based on the above scenario, it can be understood that the executor of this scenario can be an intelligent terminal that integrates the application, such as a desktop computer, a laptop computer, a tablet computer, and an interactive multimedia device, etc., and no excessive limitations are made here.

[0060] A project can be a complex set of programs that achieve different goals or functions. The project includes a clear file structure. In the program code, you can call related projects by specifying functions, and then use the functions of the project.

[0061] APK files are an application package file used by the Android operating system to distribute and install mobile applications and middleware. Specifically, if the application code wants to run on an Android device, it must first be compiled and then packaged into a file that can be recognized by the Android system before it can be run. This file that can be recognized and run by the Android system is the APK file.

[0062] The way to generate an APK file is to select the project that needs to obtain the APK file, and let the preprocessor organize the code in the project, delete comments, adjust precompilation instructions (that is, directly insert the included files into the precompilation instruction position), and add line numbers and file identifiers (so that debugging line numbers and compilation error warning line numbers are generated during compilation). Use the compiler to perform a series of syntax analysis, semantic analysis and optimization on the preprocessed file to generate assembly language. Then use the assembler to translate the assembly language into its language instructions and package it into a binary file. Merge the binary file with the file where the function called by the program is located, and compress the merged file to obtain the APK file.

[0063] S102, reading version information of the at least two APK files;

[0064] Version information can include version number and version name. The version number is used to identify versions in the application market and within the program, as well as to determine whether the version is new or old. For example, the first version number is defined as 1, and then incremented. In this way, as long as the version number is greater than the current value, it can be determined whether the application needs to be upgraded. The version number is not displayed to the user. The version name needs to be displayed to the user, and the user will recognize the version they installed through the version name. The same version name can correspond to multiple version numbers. For example, the user reported that there was a problem with the current version of the application. After the developer fixed the problem, considering that it was a minor version upgrade, the version name was not changed, but the version number was changed after the repair.

[0065] The way to read the version information of the APK file is that the smart terminal can use AAPT (Android AssetPackaging Tool, the compilation and packaging tool of the Android system) in the build-tools package under the Android SDK folder in the APK file, use the aapt dump badging XXX.apk command to view the version name and version number and other information, and read the version information.

[0066] S103, determining the compatibility between the at least two APK files according to the version information;

[0067] Compatibility can refer to the degree of coordination between hardware, software, or a combination of hardware and software. For example, if a new version of an APK file modifies or deletes a method compared to an old version of the APK file, it is very likely that the new version will be incompatible with the old version. Or, if a third-party method or application required in the new version is updated compared to the third-party method or application called in the old version, the new version of the APK file will also be incompatible with the old version of the APK file.

[0068] The method for determining the compatibility between at least two APK files can be to obtain the version information of each APK file, identify the version range that each secondary APK can be compatible with, and obtain the current version of the main APK, compare the current version of the main APK with the compatible version range, if the current version is not within the compatible version range, it proves that the secondary APK is incompatible with the main APK. For example, the version number of the main APK is 7.2, and there is a secondary APK that is only compatible with versions 8.0 and above, then the APKs are incompatible at this time; if the current version is within the compatible version range of all secondary APKs, then each APK file is decompressed to obtain specific code, the framework structure of the code is extracted according to the specific code framework structure, and the extracted framework structure is compared to identify whether there is a method in the main APK that the secondary APK is incompatible with. If so, it is determined that the secondary APK is incompatible with the main APK; if not, it is determined that the secondary APK is compatible with the main APK.

[0069] S104, determining the APK file with compatibility as a candidate APK file;

[0070] The candidate APK files can be all APK files in the application that meet the integration conditions, that is, APK files with compatibility.

[0071] The candidate APK files may be determined by screening the secondary APKs that are compatible with the primary APK, and taking both the primary APK file and the secondary APK files as candidate APK files.

[0072] S105. In response to the selection operation, determining a target APK file from the candidate APK files;

[0073] The selection operation may be that the user selects the APK file to be merged through the display device of the smart terminal. In this process, the smart terminal may display all candidate APK files, and the user clicks to select the APK file to be merged.

[0074] The target APK file may be determined by identifying the APK file that needs to be merged from the candidate APK files selected by the user, and marking the APK file selected by the user as the target APK file.

[0075] S106. Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0076] A script can be a lightweight, interpreted programming language or code snippet used to automate a series of tasks or operations. Script code usually does not need to be compiled into machine code in advance, but is directly executed by an interpreter or runtime environment, which makes the development and testing process of script code faster and more flexible. In addition, many scripting languages ​​are cross-platform and can run on different operating systems, which has better portability in different environments.

[0077] The target APK can be merged by extracting the scripts of all target APKs, analyzing the program framework and method flow in each script to obtain the calling relationship between the scripts (i.e., checking whether there is a dependency between the scripts, for example, whether the output of one script is the input of another script), copying and pasting the relevant part of each script into the main script, and refactoring the code as needed (for example, renaming variables or functions to avoid conflicts). Optimize the refactored code, delete redundant parts and optimize performance. Package the optimized script into an APK file as the fusion result.

[0078] For example, Figure 2 This is a schematic diagram of APK file integration, such as Figure 2 As shown, project A and project B are compiled respectively to obtain APK A and APK B, and the version information of APK A and APK B is obtained using a version management tool. Whether APK A and APK B are compatible is identified based on the version information. After determining that APK A and APK B are compatible, the user merges the APK files that need to be merged according to the APK selection tool, that is, selects APK A and APK B, extracts the scripts of APK A and APK B for merging, and packages the merged scripts into an APK file as the final APK.

[0079] In an embodiment of the present application, at least two APK files are generated by at least two projects; wherein each project generates an APK file; the version information of the at least two APK files is read; the compatibility between the at least two APK files is determined according to the version information; the APK file with compatibility is determined as a candidate APK file; in response to a selection operation, a target APK file is determined from the candidate APK files; a fusion operation is performed on the target APK file through a fusion script to obtain a fusion result. Through the above-mentioned APK file fusion method, multiple APK files of the same application can be generated for fusion, which is conducive to independent maintenance and independent compilation for different functions, and function selectability is realized when fusion APK files are merged to avoid resource waste.

[0080] Embodiment 2

[0081] Figure 3 It is a flow chart of a method for fusing APK files provided in Embodiment 2 of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: determining the compatibility between the at least two APK files according to the version information, including: identifying whether the at least two APK files include a main APK file; if included, obtaining the version number of the main APK file and the version number of the subsidiary APK file of the application; when the version number of the main APK file meets the minimum version compatible with the version number of the subsidiary APK file, determining that the main APK file and the subsidiary APK file are compatible.

[0082] like Figure 3 As shown, specifically including the following:

[0083] S301. Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0084] S301, reading version information of the at least two APK files;

[0085] S302, identifying whether the at least two APK files include a main APK file; if included, executing S303;

[0086] The main APK file can be the APK file where the main framework and running structure of the application are located. The application cannot run normally without the main APK file.

[0087] A method for identifying whether at least two APK files include a main APK file may be to analyze the calling relationship in the APK files, select an APK file that can call other APK files for framework structure analysis, and if the APK contains a program or algorithm that is indispensable for running the application, it is determined that the main APK file is included, and the APK file that can call other APK files is the main APK file; if there is no calling relationship in the APK file, or the main program content of the application does not exist, the generated APK file does not include the main APK file.

[0088] S303, obtaining the version number of the main APK file and the version number of the subsidiary APK file of the application;

[0089] The subsidiary APK file can be the APK file where the programs of the additional functions of the application are located. The subsidiary APK file needs to rely on the main APK file to run. If the subsidiary APK file is missing, some functions of the application will be damaged, but it will not affect the operation of the overall application. After the main APK file is determined, other APK files that can be called by the main APK file are subsidiary APK files.

[0090] The method for obtaining the version number of the main APK file and the version number of the subsidiary APK file can be that the smart terminal accesses the main APK file and the subsidiary APK file respectively, and obtains the version number of the APK file in the specified location where the version information is stored in the APK file.

[0091] S304: When the version number of the main APK file meets the lowest version compatible with the version number of the subsidiary APK file, determine that the main APK file and the subsidiary APK file are compatible;

[0092] The lowest compatible version of the version number of the attached APK file can be the earliest released version number that the attached APK file can be compatible with. Usually, the lowest compatible version of the version number of the attached APK file is the current version number of the attached APK file. In some cases, the lowest compatible version number of the APK file can also be different from its own version number. For example, if the version number of an attached APK file is 7.0, the lowest compatible version number of the file is 7.0. If the attached APK file is compatible with versions 6.5 and above, the lowest compatible version number of the file is 6.5.

[0093] A way to determine the compatibility between the main APK file and the subsidiary APK files is to obtain the lowest version number that each subsidiary APK file can be compatible with, sort the lowest version numbers, and compare them with the version number of the main APK respectively. If the version numbers of the subsidiary APK files are all smaller than the version number of the main APK file, the main APK file and the subsidiary APK files are compatible; if there is an subsidiary APK file with a version number larger than the version number of the main APK file, the main APK file and the subsidiary APK files are not compatible. At this time, the subsidiary APK files whose version numbers are smaller than the version number of the main APK file can be selected to form the compatible APK file part with the main APK file.

[0094] S305, determining the APK file with compatibility as a candidate APK file;

[0095] S306. In response to the selection operation, determine a target APK file from the candidate APK files;

[0096] S307: Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0097] The advantage of this arrangement of the present invention is that the compatibility between APK files can be determined based on the version information of the subsidiary APK files and the main APK file, thereby standardizing the APK file compatibility judgment process and improving the accuracy of APK file compatibility judgment.

[0098] Embodiment 3

[0099] Figure 4 This is a flow chart of a method for fusing APK files provided in Embodiment 3 of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: after generating at least two APK files through at least two projects, the method further includes: obtaining code features of each APK file; and determining the compatibility between the at least two APK files according to the code features.

[0100] like Figure 4 As shown, specifically including the following:

[0101] S401. Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0102] S402, obtaining code features of each APK file;

[0103] Code features can be information that can characterize the content and structure of a program from different perspectives. Code features can include various statistical measurement attributes of the code, such as the number of lines of code, the number of functions, and cyclomatic complexity, all of which belong to feature extraction methods based on attribute counting. In addition, code features can also include information based on structural metrics, which involves the analysis of the internal structure of the code, such as lexical analysis, syntax analysis, and the conversion of the code into a string of tokens that can express the meaning of the source code.

[0104] The method of obtaining the code features of each APK file can be that the smart terminal obtains multiple APK files and corresponding code features through big data, uses the code features as labels and the APK files as input variables, and conducts supervised training to obtain the association between the APK files and the code features, and then builds a big data model. The generated APK files are input into the big data model in sequence, and the big data model provides feedback on the code features corresponding to each APK file based on the association between the APK files and the code features learned in advance.

[0105] S403: Determine the compatibility between the at least two APK files according to the code features;

[0106] A way to determine the compatibility between at least two APK files may be to obtain code features of each APK file, and analyze the operating environment, database, data type, and calling interface required by each APK file based on the code features. If the operating environment, database, data type, and calling interface required by each APK file are consistent, it is determined that the APK files are compatible.

[0107] S404, determining the APK file with compatibility as a candidate APK file;

[0108] S405. In response to the selection operation, determine a target APK file from the candidate APK files;

[0109] S406: Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0110] The advantage of this setting is that the compatibility of APK files can be determined by the code features of APK files, which is conducive to improving the compatibility judgment standard on the basis of judging the compatibility of APK files according to version information, so as to avoid the inability to properly implement some functions of the application due to compatibility judgment errors.

[0111] Embodiment 4

[0112] Figure 5This is a flow chart of a method for fusing APK files provided in Embodiment 4 of the present application. This solution makes a better improvement on the above embodiment, specifically, the improvement is: obtaining the code features of each APK file, including: decompiling the code of each APK file to obtain the code content of each APK file; parsing the code content of each APK file to obtain the code features.

[0113] like Figure 5 As shown, specifically including the following:

[0114] S501. Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0115] S502, decompile the code of each APK file to obtain the code content of each APK file;

[0116] Code decompilation can be the process of converting executable program code into some form of high-level programming language so that it has a more readable format.

[0117] The code content of each APK file can be obtained by reading the APK file, parsing the bytecode or machine code in the APK file, identifying components such as instructions, constant pools, and symbol tables, and trying to understand the relationship between the components. For example, use a Java decompiler to analyze the class structure, method signatures, instruction sequences, etc. in the Java bytecode. Identify the logical relationship between variables, functions, classes, and control flows, and infer the syntax and semantics in the original source code based on the instruction sequence. Generate an approximate source code file based on the syntax and semantics (this source code file will be as close to the original source code as possible, but due to information loss and approximation during the compilation process, the generated code may have some differences from the original code). The code content of each APK file is stored in the source code file. Users can further edit or analyze the decompiled code content.

[0118] S503, parsing the code content of each APK file to obtain code features;

[0119] The code content can be parsed to obtain code features by using analysis tools to perform lexical analysis on the code content and decompose the source code into a series of tokens. These tokens are usually keywords, identifiers, operators, numbers, strings, etc. in the code. The tokens are combined into an abstract syntax tree or other intermediate representations according to the grammatical rules of the programming language. Among them, the abstract syntax tree is a tree representation of the source code structure, reflecting the statements, expressions and the relationship between them in the code. On the basis of grammatical analysis, the control flow and data flow of the code are further analyzed. Control flow analysis focuses on the execution path and conditional judgment in the code to detect potential logical errors and dead code. Data flow analysis focuses on the transfer and use of variables and data to detect potential array out-of-bounds, null pointer references and other problems. The analysis results are integrated to extract the lexical, grammatical, control flow and data flow content in the code content as code features.

[0120] S504. Determine the compatibility between the at least two APK files according to the code features;

[0121] S505, determining the APK file with compatibility as a candidate APK file;

[0122] S506. In response to the selection operation, determine a target APK file from the candidate APK files;

[0123] S507: Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0124] The advantage of this setting is that the code features of the APK file can be obtained by decompiling and parsing the code in the APK file, which is conducive to analyzing and comparing the code framework stored in the APK file, thereby improving the accuracy of compatibility judgment.

[0125] Embodiment 5

[0126] Figure 6 This is a flowchart of a method for fusing APK files provided in Embodiment 5 of the present application. This solution makes a better improvement on the above embodiment, specifically: determining the compatibility between the at least two APK files according to the code features, including: when the code features of one or more APK files are identified to have call method deletion or call method change features, determining that the APK file is not compatible with other APK files.

[0127] like Figure 6 As shown, specifically including the following:

[0128] S601. Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0129] S602, obtaining code features of each APK file;

[0130] S603: if the code features of one or more APK files are identified to have a call method deletion feature or a call method change feature, it is determined that the APK file is not compatible with other APK files;

[0131] The calling method may mean that when a method or function of another APK file is needed in one APK file, there is no need to copy all the codes in the APK file. You only need to call the required APK file according to the address information by calling the function, and you can directly use the function of the APK file.

[0132] A method for determining that an APK file is not compatible with other APK files may be to analyze the calling relationships in the code features corresponding to each APK file, obtain the calling relationships in the code features of the previous version of the APK file, and compare the calling relationships of the two versions. If it is identified that the current version has a partially missing or changed calling relationship compared to the previous version, it is determined that the current APK file is not compatible with other APK files.

[0133] S604, determining the APK file with compatibility as a candidate APK file;

[0134] S605. In response to the selection operation, determine a target APK file from the candidate APK files;

[0135] S606: Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0136] The advantage of this setting of the present invention is that it can improve the accuracy of identifying compatibility issues between APK files based on the impact of changes or deletions to the methods called in the code features on the compatibility of the APK files, so as to avoid affecting the normal operation of the application.

[0137] Embodiment 6

[0138] Figure 7 It is a flowchart of a method for fusing APK files provided in Embodiment 6 of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: according to the code features, determining the compatibility between the at least two APK files, including: when it is identified that the code features of at least two APK files have the same calling method, there are differences in the versions of the calling methods, and there is incompatibility between the different calling method versions, then determining that the at least two APK files are incompatible.

[0139] like Figure 7 As shown, specifically including the following:

[0140] S701. Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0141] S702, obtaining code features of each APK file;

[0142] S703: When it is identified that at least two APK files have the same calling method in their code features, the calling method versions are different, and there is incompatibility between the different calling method versions, it is determined that the at least two APK files are incompatible;

[0143] The same calling method may be that two or more APK files use the same calling function to call the same function, method or application.

[0144] A method for determining that at least two APK files are not compatible may be to obtain code features of each APK file, extract and analyze the calling methods therein, and when identifying that the same calling method exists in two or more APK files, obtain the object called by each APK file using the calling method, and identify the version number of each called object for comparison; if the version numbers of the same called object in each APK file are inconsistent, the smart terminal queries whether the version numbers are compatible through big data; if there are incompatible version numbers, it is determined that at least two APK files are not compatible; if all version numbers are compatible, then the APK files are compatible.

[0145] For example, if a third-party database is called in two APK files, if one APK file calls an old version of the third-party database and the other APK file calls a new version of the same third-party database, but the two versions of the third-party database are incompatible, then the two APK files are also incompatible.

[0146] S704, determining the APK file with compatibility as a candidate APK file;

[0147] S705. In response to the selection operation, determine a target APK file from the candidate APK files;

[0148] S706: Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0149] The advantage of this setting of the present invention is that it can take into account the compatibility issues between different version numbers of the same calling method in at least two APK files, which is conducive to improving the accuracy of identifying compatibility issues between various APK files to avoid affecting the normal operation of the application.

[0150] Embodiment 7

[0151] Figure 8 This is a flowchart of a method for fusing APK files provided in Embodiment 7 of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: in response to the selection operation, determining the target APK file from the candidate APK files, including: obtaining the deployment information of the application; wherein the deployment information includes at least one of the deployment area information, deployment object information, and deployment method information; determining the candidate APK file to be used as the target APK file according to the deployment information.

[0152] like Figure 8 As shown, specifically including the following:

[0153] S801. Generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0154] S802. Read version information of the at least two APK files;

[0155] S803: Determine the compatibility between the at least two APK files according to the version information;

[0156] S804, determining the APK file with compatibility as a candidate APK file;

[0157] S805, obtaining deployment information of the application; wherein the deployment information includes at least one of deployment region information, deployment object information, and deployment mode information;

[0158] Deployment can refer to the process of transferring application code and related resources from the development environment to the target environment and running and testing them in the target environment. This includes installing the developed software system on the server and configuring the necessary environment so that the software can receive user requests and perform corresponding processing.

[0159] Deployment region information, and the region where users who install and use the application are located. Based on the usage habits of regional users, the application functions that need to be integrated can be determined.

[0160] The deployment object information can be the information of the user who installs and uses the application, including age, gender, and position. Based on the user information, the usage preferences of this type of user can be predicted, and then the application functions that need to be integrated can be determined. For example, older users like to use handwriting input methods, while younger users prefer keyboard input.

[0161] The deployment method information may be information such as the application launch channel and environment. For example, when launching an application using a mini program, a simple input method may be selected, while when executing the application using a separate software, a conventional input method may be used.

[0162] The deployment information of the application can be obtained by using a configuration file to store related settings and parameters when deploying the application. The configuration file of the application is checked, and key information such as database connection, server settings, and port number contained therein is extracted as the deployment information of the application.

[0163] S806. Determine a candidate APK file to be used as a target APK file according to the deployment information;

[0164] The target APK file can be determined by analyzing the deployment information of the application, obtaining at least one of the deployment area information, deployment object information, and deployment method information and an associated subsidiary function, and using the main APK file and the subsidiary APK file corresponding to the subsidiary function as the target APK file.

[0165] For example, users in different overseas regions use different social applications. Users in region A are accustomed to using Line software, while users in region B are accustomed to using Naver software. For games in region A, you can integrate Line APK and Google Login APK, and for games in region B, you can integrate Naver APK and Google Login APK. While meeting operational needs, you can also avoid the waste of memory resources caused by bringing unused Line APK into the APK file of region B.

[0166] S807: Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0167] The advantage of this arrangement of the present invention is that the necessary target APK files can be determined for integration according to different deployment information, thereby reducing the size of the APK file while ensuring that the functions required by the application are complete, thereby avoiding waste of memory resources.

[0168] Embodiment 8

[0169] Fig. 9 It is a structural diagram of an APK file fusion device provided in Example 8 of the present application.

[0170] like Fig. 9 As shown, specifically including the following:

[0171] An APK file generating module 901 is used to generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0172] A version information reading module 902, used to read the version information of the at least two APK files;

[0173] A compatibility determination module 903, configured to determine the compatibility between the at least two APK files according to the version information;

[0174] A candidate file determination module 904, configured to determine compatible APK files as candidate APK files;

[0175] A target file determination module 905, configured to determine a target APK file from the candidate APK files in response to a selection operation;

[0176] The APK file fusion module 906 is used to perform a fusion operation on the target APK file through a fusion script to obtain a fusion result.

[0177] In an embodiment of the present application, the APK file generation module is used to generate at least two APK files through at least two projects; wherein each project generates one APK file;

[0178] A version information reading module, used to read the version information of the at least two APK files;

[0179] A compatibility determination module is used to determine the compatibility between the at least two APK files according to the version information; a candidate file determination module is used to determine the APK files with compatibility as candidate APK files; a target file determination module is used to determine the target APK files from the candidate APK files in response to the selection operation, and to select the required APK files to be merged into an application package and put on the market, which is beneficial for targeting different target APK files; an APK file fusion module is used to perform a fusion operation on the target APK file through a fusion script to obtain a fusion result. Through the above-mentioned APK file fusion device, multiple APK files of the same application can be generated for fusion, which is beneficial for independent maintenance and independent compilation of different functions, and to realize function selectability when merging APK files to avoid waste of resources.

[0180] In the embodiment of the present application, a device for fusing an APK file may be a device, or a component, integrated circuit or chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device may be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0181] In the embodiment of the present application, a device for fusing an APK file may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0182] The device for fusing APK files provided in the embodiment of the present application can implement each process implemented in the above-mentioned method embodiments. To avoid repetition, they will not be described here.

[0183] Embodiment 9

[0184] like Fig.10 As shown, an embodiment of the present application also provides an electronic device 1000, including a processor 1001, a memory 1002, and a program or instruction stored in the memory 1002 and executable on the processor 1001. When the program or instruction is executed by the processor 1001, each process of an embodiment of a device for fusing an APK file described above is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0185] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0186] Embodiment 10

[0187] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the device embodiment for fusing the above-mentioned APK file are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0188] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0189] Embodiment 11

[0190] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned device embodiment for fusing APK files, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0191] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0192] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0193] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0194] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

[0195] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A method for fusing APK files, characterized in that: The method comprises: Generate at least two APK files through at least two projects; wherein each project generates one APK file; Reading version information of the at least two APK files; Determine the compatibility between the at least two APK files according to the version information; Determine the compatible APK files as candidate APK files; In response to a selection operation, determining a target APK file from the candidate APK files; Perform a fusion operation on the target APK file through a fusion script to obtain a fusion result; Among them, the method of performing the fusion operation on the target APK is to extract the scripts of all target APKs, analyze the program framework and method flow in each script to obtain the calling relationship between the scripts, copy and paste the relevant parts of each script into the main script, reconstruct the code, optimize the reconstructed code, delete the redundant parts and optimize the performance, and package the optimized script into an APK file as the fusion result.

2. The method for merging APK files according to claim 1, characterized in that: Determining the compatibility between the at least two APK files according to the version information includes: Identifying whether the at least two APK files include a main APK file; If included, obtain the version number of the main APK file and the version number of the auxiliary APK file of the application; When the version number of the main APK file meets the lowest version compatible with the version number of the subsidiary APK file, it is determined that the main APK file and the subsidiary APK file are compatible.

3. The method for merging APK files according to claim 1, characterized in that: After generating at least two APK files through at least two projects, the method further includes: Get the code characteristics of each APK file; The compatibility between the at least two APK files is determined based on the code features.

4. The method for merging APK files according to claim 3, characterized in that: Get the code characteristics of each APK file, including: Decompile the code of each APK file to obtain the code content of each APK file; The code content of each APK file is parsed to obtain code features.

5. The method for merging APK files according to claim 3, characterized in that: Determining the compatibility between the at least two APK files according to the code features includes: When it is identified that one or more APK files have code features that include call method deletion or call method change features, it is determined that the APK file is not compatible with other APK files.

6. The method for merging APK files according to claim 3, characterized in that: Determining the compatibility between the at least two APK files according to the code features includes: When it is identified that at least two APK files have the same calling method in their code features, the calling method versions are different, and there is incompatibility between the different calling method versions, it is determined that the at least two APK files are incompatible.

7. The method for merging APK files according to claim 1, characterized in that: In response to the selection operation, determining a target APK file from the candidate APK files includes: Obtaining deployment information of the application; wherein the deployment information includes at least one of deployment region information, deployment object information, and deployment method information; A candidate APK file to be used is determined as a target APK file according to the deployment information.

8. An APK file fusion device, characterized in that: The device comprises: An APK file generation module, used to generate at least two APK files through at least two projects; wherein each project generates one APK file; A version information reading module, used to read the version information of the at least two APK files; A compatibility determination module, configured to determine the compatibility between the at least two APK files according to the version information; A candidate file determination module, used to determine compatible APK files as candidate APK files; a target file determination module, configured to determine a target APK file from the candidate APK files in response to a selection operation; An APK file fusion module is used to perform a fusion operation on the target APK file through a fusion script to obtain a fusion result; Among them, the method of performing the fusion operation on the target APK is to extract the scripts of all target APKs, analyze the program framework and method flow in each script to obtain the calling relationship between the scripts, copy and paste the relevant parts of each script into the main script, reconstruct the code, optimize the reconstructed code, delete the redundant parts and optimize the performance, and package the optimized script into an APK file as the fusion result.

9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein when the program or instruction is executed by the processor, the steps of a method for fusing APK files as described in any one of claims 1 to 7 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the APK file fusion method described in any one of claims 1-7 are implemented.