SO file packaging method, plug-in, computer equipment and storage medium

By replacing the original SO file with a specific SO file during the Android application construction process, the application crash caused by random selection is solved, the construction efficiency and quality is improved, and the correct packaging and application stability of the specific SO file is ensured.

CN119166169APending Publication Date: 2024-12-20GUANGZHOU HUYA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411418285.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

In Android application development, the strategy of randomly selecting SO files may cause the application to run crashes, especially when a specific version of the libc++_shared.SO library is required. It is impossible to guarantee that a compatible SO file will be selected, which will affect the stability and construction of the application. quality.

Method used

During the application construction process, determine the original SO file involved in the construction and replace it with a specific SO file. If the same is true, continue to package it, thereby ensuring that the specific SO file is correctly packaged and avoiding the crash problem caused by random selection. Apply optimization measures during the compilation process.

Benefits of technology

By replacing specific SO files, the application crash problem is solved, and the APK construction efficiency and quality is improved, ensuring that the compilation optimization operations are applied to the replaced specific SO files, avoiding the lengthening of the compilation process and ensuring the stability and efficiency of the build.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166169A_ABST
    Figure CN119166169A_ABST
Patent Text Reader

Abstract

The invention provides an SO file packaging method, a plug-in, computer equipment and a storage medium, and relates to the technical field of software development, the method comprises the following steps: in a construction process of an application program, determining an original SO file participating in construction; when the original SO file is different from a specific SO file corresponding to the application program, replacing the original SO file with the specific SO file; and packaging by using a specific SO file. According to the method, the problem of application running crash caused by random selection of an SO file strategy can be avoided, the APK construction efficiency can be improved, and the construction quality can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to an SO file packaging method, a plug-in, a computer device and a storage medium. Background Art

[0002] In Android application development, the application functions can be enhanced by integrating third-party dependent libraries. Some third-party dependent libraries carry SO files, i.e. native dynamic link libraries, which may have file name conflicts in certain situations, i.e. the same file name corresponds to multiple different SO files. When SO files with the same name under the same Application Binary Interface (ABI) exist in different libraries, errors may be reported in the packaging stage during the compilation process.

[0003] In the face of the above error phenomenon, the official technology is to randomly select one of the SO files for packaging when encountering multiple SO files with the same name. Although this method can solve the error problem in some cases, in scenarios where specific SO files are required, such as when upgrading the React Native (RN) dependency library, a specific version of the libc++_shared.SO library is required. This random selection method has certain uncertainties and cannot guarantee that the specific SO file that the user wants will always be selected. If an incompatible or incorrect version of the SO file is randomly selected, it may cause the application to crash when it is running.

[0004] In view of the possible crash problem mentioned above, how to provide a stable and reliable SO file packaging method is a technical problem that needs to be solved. Summary of the invention

[0005] One of the purposes of the present invention is to provide a SO file packaging method, plug-in, computer device and storage medium, which can avoid the application operation crash problem caused by the random selection of SO file strategy, and can also improve the APK construction efficiency and ensure the construction quality. The embodiment of the present invention can be implemented as follows:

[0006] In a first aspect, the present invention provides a SO file packaging method, the method comprising: during the construction process of an application, determining the original SO file involved in the construction; when the original SO file is different from the specific SO file corresponding to the application, replacing the original SO file with the specific SO file; and packaging using the specific SO file.

[0007] In a second aspect, the present invention provides an SO file packaging plug-in, comprising: a determination module, used to determine the original SO file involved in the construction during the construction process of the application; a replacement module, used to replace the original SO file with the specific SO file corresponding to the application when the original SO file is different from the specific SO file corresponding to the application; and a packaging module, used to use the specific SO file for packaging.

[0008] In a third aspect, the present invention provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the SO file packaging method as described in the first aspect above.

[0009] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the SO file packaging method as described in the first aspect is implemented.

[0010] The SO file packaging method, plug-in, computer device and storage medium provided by the embodiment of the present invention have the following advantages: during the construction process, if the original SO file involved in the construction is not a specific SO file, it will be replaced with a specific SO file before packaging, which means that if they are the same, packaging will continue, so that the specific SO file can be packaged into the application, solving the problem of application crashes due to inappropriate or incompatible randomly selected SO files. In addition, the embodiment of the present invention performs replacement during the construction process, specifically, after the SO file is determined, it is replaced, and packaging is performed after the replacement is completed, which will not cause the entire compilation and construction process to become longer, and can ensure that the compilation optimization applied during compilation (such as removing debugging information and compression) will not be lost, and can be applied to the replaced specific SO file, which can improve the construction efficiency and ensure the construction quality of the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0012] Figure 1 A schematic diagram of a scenario of a SO file packaging method provided by an embodiment of the present invention;

[0013] Figure 2 A schematic diagram of installing an application on a terminal device in an embodiment of the present invention;

[0014] Figure 3A schematic flow chart of a SO file packaging method provided by an embodiment of the present invention;

[0015] Figure 4 A schematic diagram of an APK crash caused by a random selection strategy provided in an embodiment of the present invention;

[0016] Figure 5 A schematic diagram of the result of the SO file packaging method provided by an embodiment of the present invention;

[0017] Figure 6 A functional module diagram of the SO file packaging plug-in provided by an embodiment of the present invention;

[0018] Figure 7 A structural block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0020] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0022] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0023] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.

[0024] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0025] Please refer to Figure 1 , Figure 1 A schematic diagram of a scenario of a SO file packaging method provided by an embodiment of the present invention, such as Figure 1 As shown, the computer device 10 may be, but is not limited to, a developer's personal computer, a server, a cloud building service platform, etc. The computer device 10 has a compilation framework, which can be used to automate the entire compilation and building process of the application.

[0026] For example, for Android applications, the computer device 10 may have a compilation framework Gradle. Among them, AGP (Android Gradle Plugin) is a Gradle plug-in specially designed for Android application development, which provides a complete set of solutions and automation tools for building Android applications.

[0027] like Figure 1 As shown, developers can use the computer device 10 to generate multiple SO files. SO files, full name Shared Object files, contain native code written in C or C++. For example, Figure 1 It should be understood that SO files 1 to SO files n are shown in FIG. Figure 1 It is shown that the generation of the SO file and the construction of the application installation package (Android Application Package, APK) are performed on the same computer device 10, but this should not be understood as a limitation on the devices for generating the SO file and building the APK. They can also be performed on different devices as long as the corresponding development tools and environment are installed.

[0028] Among them, the ABI of different CPU architectures is different, and there may be multiple different SO files with the same name under the same ABI. For example Figure 1 The two SO files 1 shown in the figure are two SO files with the same ABI and the same file name SO file 1, but the file contents are actually different.

[0029] During the Android application building process, packaging SO files into the Android application package (APK) is part of the building process so that they can be loaded and used when running the application to enhance the functionality and performance of the application.

[0030] For example, taking the Gradle build system as an example, when the computer device 10 builds an APK, the process of packaging an SO file generally involves the following Gradle tasks:

[0031] The mergeNativeLibs task, referred to as the "SO file deduplication merging task" in the embodiment of the present invention, searches for SO files in multiple places, including but not limited to the source code directory of the project, dependent AAR files, and dependencies configured by the NDK component of the AndroidSDK, and merges all SO files of the ABI architecture into a unified directory.

[0032] The stripDebugSymbols task, referred to as the "debugging information stripping task" in the embodiment of the present invention, is used to facilitate debugging of native code. SO files usually contain debugging symbols, symbol tables, etc. However, during the build process, in order to reduce the size of the APK, these debugging information are usually stripped from the .SO file. This task is to perform this stripping process.

[0033] exportSo task, referred to as "SO file export task" in the embodiment of the present invention, is to export the merged .SO file to a directory that can be packaged by APK. It ensures that the .SO file is placed in the correct location of the build output directory.

[0034] Compress task, referred to as "compression task" in the embodiment of the present invention, starting from AGP 7.0 version, SO files will be compressed by default to reduce the size of APK. This task is responsible for compressing .SO files and placing them in the corresponding compressed format in the lib directory of APK.

[0035] Package task, referred to as "packaging task" in the embodiment of the present invention, is the final packaging task, which packages the task output results of the above four tasks, namely the SO file and other resources that need to be packaged into an APK.

[0036] The execution order of the above five tasks is: mergeNativeLibs->stripDebugSymbols->exportSo->Compress->Package. The whole process is automated. Through these tasks, it is ensured that the SO file can be effectively integrated into the application installation package. Finally, the computer device 10 publishes the built application installation package to the terminal device.

[0037] See also Figure 2 , Figure 2 FIG. 1 is a schematic diagram of installing an application on a terminal device in an embodiment of the present invention. Figure 2 As shown, Figure 1 The APK built in can be published to Figure 2 The application market (also known as the application store) in Figure 2In (a) of FIG. 1 , the user can click or use other triggering methods to open the application market, and then the user interface of the terminal device displays the following information: Figure 2 In the application market interface shown in (b), you can see the released Figure 1 The application installation package built in the program can be downloaded and installed by the user by clicking or other triggering methods to trigger the download button.

[0038] It should be understood that Figure 2 The terminal device drawn in the figure is a mobile phone, but it should not be understood as a limitation on the terminal device. It can also be any device equipped with the above-mentioned application, such as a tablet computer, a laptop computer, a desktop computer, a smart TV, a car computer, a smart wearable device, etc.

[0039] In the process of building the application above, the SO file deduplication and merging task involves deduplication and merging of SO files under all ABIs involved in the build. Because there may be multiple different SO files with the same name under the same application binary interface (ABI, which is different for different CPU architectures), an exception will be thrown during the Package packaging stage: More than one file was found with OS independent path.

[0040] For the above exception, the general method is to use a random selection strategy to select one from multiple SO files with the same name. For example, for the build system Gradle, you can set its configuration option packagingOptions to pickFirst, which means that only the first SO file with the same name found will be packaged into the APK. The configuration of packagingOptions takes effect in the mergeNativeLibs task.

[0041] by Figure 1 For example, suppose SO file 1 and SO file 2 are two different files under the same ABI, but have the same file name. Then when executing the mergeNativeLibs task, if the first file found is SO file 1, SO file 1 will be packaged into the APK.

[0042] The inventor has found through research that this random selection method is not suitable for scenarios where an application requires a specific SO file. Therefore, an embodiment of the present invention provides a SO file packaging method, which is suitable for scenarios where a specific SO file needs to be packaged. Figure 3 , Figure 3 The schematic flow chart of the SO file packaging method provided by the embodiment of the present invention may include the following steps:

[0043] S301, during the construction process of the application, determining the original SO file involved in the construction;

[0044] S302, when the original SO file is different from the specific SO file corresponding to the application, the original SO file is replaced with the specific SO file;

[0045] S303, using a specific SO file for packaging.

[0046] In one embodiment of the present invention, the scheme using the above steps S301 to S303 has the following two advantages: Advantage 1. First, during the construction process, if the original SO file involved in the construction is not a specific SO file, it will be replaced with a specific SO file before packaging. This means that if they are the same, packaging will continue. In this way, the specific SO file can be packaged into the application, solving the problem of application crashes due to inappropriate or incompatible randomly selected SO files. Advantage 2. In the embodiment of the present invention, the replacement is performed during the construction process, specifically, the replacement is performed after the SO file is determined, and packaging is performed after the replacement is completed. This will not cause the entire compilation and construction process to become longer, and can ensure that all compilation optimization measures, such as removing debugging information and file compression, can be applied to the replaced specific SO file, thereby improving the construction efficiency and ensuring the construction quality of the APK.

[0047] The following is a detailed and clear introduction and explanation of each of the above steps.

[0048] From the above introduction of the mergeNativeLibs task, we can know that this task is responsible for searching for SO files in multiple places and merging them. This means that after the task is completed, it is possible to determine which original SO files are involved in building the application. Therefore, in one embodiment of the present invention, step S301 can be implemented by creating an SO file deduplication and merging task for the application, and determining the original SO files involved in the construction by executing the SO file deduplication and merging task.

[0049] In an optional implementation, during the execution of the SO file deduplication and merging task, the name of the SO file involved in building the application can be determined first; when there are multiple SO files corresponding to the SO file name, one of the SO files is randomly selected or the first discovered SO file with the same name is used as the original SO file.

[0050] It can also be seen from the above embodiments that the embodiment of the present invention replaces the original SO file with a specific SO file after executing the SO file deduplication and merging task. This ensures that subsequent compilation optimization operations can be applied to the replaced specific SO file, thereby ensuring the build quality of the APK.

[0051] In one embodiment of the present invention, based on the address of the temporary directory folder of the original SO file output by the SO file deduplication and merging task, the implementation of step S302 may include the following steps:

[0052] Step a1: Get the address of the temporary directory folder of the original SO file.

[0053] In the embodiment of the present invention, after the original SO file involved in the construction process is determined, the address of the temporary folder of the original SO file can be obtained, which provides a basis for subsequent replacement.

[0054] Step a2: Determine the compilation type corresponding to the application.

[0055] Step a3: Read the replacement parameter corresponding to the compilation type.

[0056] In one embodiment of the present invention, considering that in current Android application development, different versions of applications can be generated according to different configuration options during the construction process, the embodiment of the present invention refers to applications of different compilation types as different types of build variants. The type of build variant can be defined by the developer, and each build variant will eventually be packaged into one or more APK files for installation on an Android terminal device.

[0057] Compilation variants can be distinguished based on different dimensions, including but not limited to build types (BuildTypes) and product flavors (Flavors). For example, build types can include build (Debug), release (Release), etc. Product flavors can include full version (Lull), simplified version (Lite) and official (Official), etc. Assuming that the local compilation task uses the Lebug build type and the Official product flavor, the corresponding compilation variant type is the OfficialDebug type.

[0058] The Gradle plug-in can determine the compilation type of the application currently being compiled through the task name executed by the command line. In one embodiment of the present invention, all compilation variants of the application can be pre-defined, such as officialDebug and officialRelease, and associated replacement parameters of specific SO files are created for all compilation variants to quickly complete the replacement.

[0059] Therefore, before packaging the SO file, the embodiment of the present invention can pre-configure the application of each compilation type, that is, the replacement parameters associated with each compilation variant, through the following steps, which provides a basis for the subsequent rapid completion of the replacement. In an optional implementation, the embodiment of the present invention can perform the following steps to complete the configuration:

[0060] Step b1: Predefine multiple compilation types for the application.

[0061] In one embodiment of the present invention, developers can predefine multiple types of compilation variants, and each compilation variant is a type of application after compilation. For example, according to the product flavor offical and the build types Debug and Release, two compilation variants can be obtained: officalDebug and officalRelease. For each compilation variant, a corresponding build task is executed to generate a corresponding APK file. Each APK can be released to different markets or channels according to the purpose of its compilation variant.

[0062] Step b2: Configure the replacement parameters of the specific SO files required for each compilation type.

[0063] Step b3: Establish a correspondence between the compilation type and the replacement parameter.

[0064] For the above step b2, in one embodiment of the invention, the relative path of the SO file to be replaced and the absolute path of the specific SO file are used as replacement parameters. For example, assuming that a replacement parameter in the embodiment of the present invention is:

[0065] "lib / arm64-v8a / libc++_shared.so":"$rootDir / nominate_so / arm64-v8a / libc++_shared.so".

[0066] The replacement parameter means replacing the 64-bit SO file libc++_shared.so in the temporary folder with a specific SO file in the nominate_so folder in the project root directory.

[0067] In an optional implementation, the above replacement parameters may be maintained in a key-value pair manner. For example, in an optional implementation, the relative path of the SO file to be replaced is set as the key of the key-value pair, and the absolute path of the specific SO file is set as the value of the key-value pair, so that the key-value pair can be directly read when executing the replacement task.

[0068] In the embodiments of steps b1 to b3 above, multiple compilation types are predefined for the application, allowing developers to customize different compilation types according to different publishing requirements and environments, and configure the most suitable SO file for each type. By configuring the replacement parameters, it can be ensured that a specific SO file is correctly used for replacement in the future. By establishing a correspondence between the compilation type and the replacement parameters, the specific SO file can be quickly determined by reading the correspondence during the replacement process, thereby improving the replacement speed.

[0069] Step a4: Complete the replacement of the original SO file according to the address of the temporary folder and the replacement parameters.

[0070] In one embodiment of the present invention, since the pre-configured replacement parameters include the absolute address of a specific SO file, when replacing, the implementation method of step a4 may be: reading the absolute address of the specific SO file from the replacement parameters; reading the specific SO file according to the absolute address; and copying the specific SO file to the temporary folder according to the address of the temporary folder and overwriting the original SO file.

[0071] In the embodiments of steps a1 to a4 above, by obtaining the address of the temporary folder containing the original SO files, it is possible to ensure that one knows where to find and locate the original SO files that need to be replaced, and then by identifying the compilation type of the application and reading the replacement parameters corresponding to the compilation type, it is possible to ensure that the original SO files are replaced with specific SO files, and that the replacement of the original SO files is completed based on the address of the temporary folder and the replacement parameters, ensuring that the final APK contains the specific SO files. This process can reduce the need to manually replace files after building and reduce the error rate.

[0072] In one embodiment of the present invention, in order to implement the configuration of the replacement parameters, a replacement task may be created in advance for each compiled type of application program, which is recorded as a nominateSo task, and the replacement parameters may be configured in the replacement task.

[0073] In an optional implementation, a replacement task may be created based on a compilation framework used by an application, and then a set of operations for defining replacement parameters may be created for the replacement task using a domain-specific language (DSL) specifically targeted at a specific application domain.

[0074] For example, taking the Gradle build system as an example, you can use the official api org.gradle.api.plugins.ExtensionContainer in the Gradle build system to create a custom extension. For example: #create(java.lang.String,java.lang.Class <t>,java.lang.Object), which is a method of the ExtensionContainer interface, used to create a new extension instance, which allows developers to pass custom replacement parameters into the custom extension class (class) to complete the configuration of the replacement parameters.

[0075] In addition, in the process of implementing the embodiment of the present invention by creating a replacement task, in order to ensure that the compilation optimization operation can be applied to a specific SO file, the embodiment of the present invention can also set the execution order of the replacement task, that is, set the execution order of the replacement task before executing the stripping and compression of the debug information. For example, the execution order of the five tasks of the Gradle build system mergeNativeLibs->stripDebugSymbols->exportSo->Compress->Package is set to mergeNativeLibs->nominateSo->stripDebugSymbols->exportSo->Compress->Package.

[0076] It can be understood that, based on the above execution order setting, after executing the mergeNativeLibs task, the address of the temporary folder of the original SO file can be obtained, and the address can be used as the input parameter of the nominateSo task. By executing the nominateSo task, the purpose of replacing the original SO file with a specific SO file can be achieved.

[0077] Further, after the original SO file is replaced with the specific SO file, the specific SO file can continue to participate in the subsequent construction process normally, that is, in step S303, an implementation method of the embodiment of the present invention may be:

[0078] Step c1: Strip the debug information from the specific SO file.

[0079] Step c2: Export the stripped specific SO file to the build output directory.

[0080] Step c3: In the build output directory, compress the specific SO file and place the compressed specific SO file in the specified directory of the application.

[0081] Step c4: In the specified directory, package based on the specific SO file.

[0082] Taking the five tasks of the Gradle build system as an example, after completing the replacement task, the four tasks of stripDebugSymbols, exportSo, Compress, and Package are continued to be executed based on the specific SO file, ensuring that the specific SO file can participate in the subsequent processes normally and complete the high-quality construction of the APK.

[0083] The following is a specific example to demonstrate the beneficial effects of the SO file packaging method provided by the embodiment of the present invention. First, before the SO file packaging method provided by the embodiment of the present invention is adopted, the random selection strategy can only ensure the normal compilation process, but cannot correctly select the specific version of the SO file libec++_shared.SO, resulting in a crash when the APK is running. Figure 4 As shown, Figure 4 A schematic diagram of an APK crash caused by a random selection strategy provided in an embodiment of the present invention.

[0084] Through the SO file packaging method provided by the embodiment of the present invention, even if a random strategy is used to select an SO file, it can be replaced with a specific SO file during the compilation process, and the specific SO file can be successfully packaged into the APK without affecting the normal compilation time. Figure 5 , Figure 5 A result schematic diagram of the SO file packaging method provided in an embodiment of the present invention.

[0085] exist Figure 5 In the above figure, the one without APK suffix is ​​the specific SO file libc++_shared_v8.so, and the one with APK suffix is ​​the SO file extracted from the compiled APK. From the BuildId, we can see that they are the same file, which means that the specific SO file used in the replacement process correctly participates in the compilation of stripDebugSymbols, exportSo, Compress, and Package processes, which can avoid the problem. Figure 4 Crash issues that occur in .

[0086] Based on Figure 3 With the same inventive concept, the embodiment of the present invention also provides an SO file packaging plug-in 60. Figure 6 , Figure 6 The functional module diagram of the SO file packaging plug-in provided by the embodiment of the present invention may include: a determination module 601, a replacement module 602 and a packaging module 603.

[0087] The determination module 601 is used to determine the original SO file involved in the construction during the construction process of the application program;

[0088] A replacement module 602, configured to replace the original SO file with the specific SO file when the original SO file is different from the specific SO file corresponding to the Android application;

[0089] The packaging module 603 is used to package using a specific SO file.

[0090] It is understandable that the determination module 601, the replacement module 602 and the packaging module 603 can be executed in coordination. Figure 3 Each step in the process is performed to achieve the corresponding technical effect.

[0091] In an optional implementation, the replacement module 602 is specifically used to obtain the address of the temporary folder of the original SO file; determine the compilation type corresponding to the application; read the replacement parameters corresponding to the compilation type; and complete the replacement of the original SO file according to the address of the temporary folder and the replacement parameters.

[0092] In an optional implementation, the replacement module 602 is further specifically used to obtain the absolute address of a specific SO file from the replacement parameters; read the specific SO file according to the absolute address; and copy the specific SO file to the temporary directory folder according to the address of the temporary directory folder and overwrite the original SO file.

[0093] In an optional implementation, the determination module 602 is specifically used to determine the name of the SO file involved in building the application; when there are multiple SO files corresponding to the SO file name, one of the SO files is randomly selected as the original SO file.

[0094] In an optional implementation, the packaging module 602 is specifically used to strip the debugging information in a specific SO file; export the stripped specific SO file to a build output directory; in the build output directory, compress the specific SO file and place the compressed specific SO file in a specified directory of the application; in the specified directory, package based on the specific SO file.

[0095] In an optional implementation, the SO file packaging plug-in 60 provided in the embodiment of the present invention may also include a creation module for predefining multiple compilation types for the application; configuring replacement parameters of specific SO files required for each compilation type; and establishing a correspondence between the compilation type and the replacement parameters.

[0096] In an optional implementation, a module is created, specifically configured to use the relative path of the SO file to be replaced and the absolute path of the specific SO file as replacement parameters.

[0097] It should be noted that the division of modules in the above embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.

[0098] The present application embodiment also provides an implementation of a computer device 10, which is used to execute the SO file packaging method provided in the present invention embodiment. Figure 7 , Figure 7 The computer device 10 provided in the embodiment of the present invention is a block diagram of a structure of a computer device, the computer device 10 includes: a memory 101, a processor 102, a communication interface 103 and a bus 104. The memory 101, the processor 102 and the communication interface 103 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0099] Optionally, bus 104 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0100] In the embodiment of the present application, the processor 102 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiment of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor. The software module may be located in the memory 101, and the processor 102 reads the program instructions in the memory 101, and completes the steps of the above method in combination with its hardware.

[0101] In the embodiment of the present application, the memory 101 may be a non-volatile memory, such as a hard disk (HDD) or a solid-state drive (SSD), etc., or a volatile memory (VolatileMemory), such as RAM. The memory may also be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in the embodiment of the present application may also be a circuit or any other device that can realize a storage function, for storing instructions and / or data.

[0102] The memory 101 can be used to store software programs and modules, such as the instructions / modules of the SO file packaging plug-in 60 provided in the embodiment of the present invention, which can be stored in the memory 101 in the form of software or firmware (Firmware) or in the operating system (OS) of the solidified computer device 10. The processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 101. The communication interface 103 can be used to communicate signaling or data with other node devices.

[0103] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0104] Understandably, Figure 7 The structure shown is for illustration only. The computer device 10 may also include Figure 7 More or fewer components as shown, or with Figure 7 Different configurations are shown. Figure 7 The components shown may be implemented in hardware, software or a combination thereof.

[0105] The computer device 10 can be any electronic product that can interact with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.

[0106] The computer device 10 may also include a network device and / or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.

[0107] The network where the computer device 10 is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.

[0108] Based on the above embodiments, the present application further provides a storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the SO file packaging method provided in the above embodiments.

[0109] Based on the above embodiments, the embodiments of the present application further provide a computer program, which, when executed on a computer, enables the computer to execute the SO file packaging method provided in the above embodiments.

[0110] Based on the above embodiments, the embodiments of the present application further provide a chip, which is used to read a computer program stored in a memory and to execute the SO file packaging method provided in the above embodiments.

[0111] The embodiment of the present application also provides a computer program product, including instructions, which, when executed on a computer, enables the computer to execute the SO file packaging method provided in the above embodiment.

[0112] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0113] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0114] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0115] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.< / t>

Claims

1. A SO file packaging method, characterized in that: The method comprises: During the application build process, determine the original SO files involved in the build; When the original SO file is different from the specific SO file corresponding to the application, replacing the original SO file with the specific SO file; The specific SO file is used for packaging.

2. The SO file packaging method according to claim 1, characterized in that: Replacing the original SO file with the specific SO file includes: Get the address of the temporary folder of the original SO file; Determining a compilation type corresponding to the application; Reading a replacement parameter corresponding to the compilation type; The original SO file is replaced according to the address of the temporary folder and the replacement parameter.

3. The SO file packaging method according to claim 2, characterized in that: The original SO file is replaced according to the address of the temporary folder and the replacement parameter, including: Obtaining the absolute address of the specific SO file from the replacement parameter; Read the specific SO file according to the absolute address; According to the address of the temporary folder, the specific SO file is copied to the temporary folder and the original SO file is overwritten.

4. The SO file packaging method according to any one of claims 1 to 3, characterized in that: The method further comprises: Predefine multiple compilation types for the application; Configure the replacement parameters of the specific SO files required for each of the compilation types; A correspondence between the compilation type and the replacement parameter is established.

5. The SO file packaging method according to claim 4, characterized in that: Configure the replacement parameters of the specific SO files required for each of the above compilation types, including: The relative path of the SO file to be replaced and the absolute path of the specific SO file are used as the replacement parameters.

6. The SO file packaging method according to claim 1, characterized in that: During the application build process, determine the original SO files involved in the build, including: Determine the SO file names involved in building the application; When there are multiple SO files corresponding to the SO file name, one of the SO files is randomly selected as the original SO file.

7. The SO file packaging method according to claim 1, characterized in that: The specific SO file is used for packaging, including: Strip the debugging information from the specific SO file; Export the stripped SO file to the build output directory; In the build output directory, compress the specific SO file and place the compressed specific SO file in a designated directory of the application; In the specified directory, packaging is performed based on the specific SO file.

8. A SO file packaging plug-in, characterized in that: include: Determine the module, which is used to determine the original SO file involved in the construction process of the application; A replacement module, used for replacing the original SO file with the specific SO file when the original SO file is different from the specific SO file corresponding to the application; The packaging module is used to package using the specific SO file.

9. A computer device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the SO file packaging method according to any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the SO file packaging method according to any one of claims 1 to 7 is implemented.