Generation method of channel game package
By accessing the common channel SDK library and Gradle plug-in, game packages for adaptive channels are generated, which solves the problems of decompilation difficulties and insufficient customization in the existing technology, and realizes efficient and flexible channel game package generation to meet diverse needs.
Patent Information
- Application Number
- CN202510351779.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-07-08
AI Technical Summary
When accessing Android games with multi-channel SDK, the existing technology has difficulty in decompiling, complex modification, and error-prone, and cannot generate AAB packages suitable for Google Mall. The degree of customization is low and it is difficult to meet the diverse needs of different channels.
By accessing the universal channel SDK library, using Gradle scripts to build channel package configuration parameters, generate independent file directories, and automatically generate game packages that adapt to the channel in the official Android construction process through Gradle plug-in to avoid decompilation operations and achieve seamless connection between channel SDK and general SDK.
It realizes flexible generation of game packages from different channels, improves construction efficiency, avoids the complexity of Smali modification, ensures that game packages operate normally on various channels, and meets diverse customization needs.
Smart Images

Figure CN120268055A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of game development, and particularly to a method for generating channel game packages. Background Art
[0002] When Android games are connected to multi-channel SDKs, a secondary modification scheme based on decompilation is generally adopted. The core process of this scheme is as follows: First, the original game project package (parent package) and the target channel SDK are respectively compiled to generate intermediate products; subsequently, the decompilation operation is performed on the compiled package body, and it is decomposed into editable smali bytecode and resource files; on this basis, developers need to perform manual intervention on the decompiled code and resources, including but not limited to modifying the `AndroidManifest.xml` configuration file, replacing specific resource files (such as icons, layouts), inserting channel SDK initialization code, and other adaptability adjustments; after completing the above modifications, the recompilation and resigning operations need to be performed on the processed content, and finally, a game installation package (APK) adapted to a specific channel is generated.
[0003] However, this method has the following significant defects: First, limited by decompilation technology, it is impossible to produce AAB (Android App Bundle) packages suitable for being put on the Google Play store, which severely restricts the publishing ability of games on mainstream distribution channels; second, this scheme involves modifying smali bytecode during the operation. Since Smali is the assembly-level representation of Dex files, its syntax is complex and tightly coupled with virtual machine instructions, making this modification relatively difficult. It not only requires developers to have profound professional knowledge but also is prone to errors. Once the modification is improper, it may cause the game to run abnormally or even crash. In addition, the customization level of this traditional method is relatively low, and it is difficult to meet the diverse customization requirements of game developers for game functions, interfaces, operation strategies, etc. on different channels. Summary of the Invention
[0004] In order to solve the deficiencies existing in the prior art, the purpose of this application is to provide a method for generating channel game packages, which can flexibly generate game packages corresponding to the special requirements of different channels without decompilation.
[0005] To achieve the above purpose, this application provides a method for generating channel game packages, including:
[0006] Connect the game to a general channel SDK library, and the SDK library constructs an abstract interface including SDK methods for all channels;
[0007] Construct a Gradle script for channel package configuration parameters for several channels;
[0008] In response to the Gradle script, an independent file directory corresponding to each channel is automatically generated, and a channel configuration file regarding the channel configuration parameters corresponding to the belonging channel is generated in the independent file directory;
[0009] Configure the specific code files and resource files corresponding to each channel in the corresponding independent directory;
[0010] In the official Android build process, generate a game package adapted to the channel through the Gradle plugin according to the channel configuration file, code file, and resource file within the channel.
[0011] Furthermore, the channel package configuration parameters at least include the version of the SDK, the application name of the channel package, the application ID, and the signature.
[0012] Furthermore, the SDK methods at least include initialization, login, and payment methods.
[0013] Furthermore, the channel configuration parameters at least include the channel ID and the channel key.
[0014] Furthermore, the resource file at least includes one of a picture file, a text file, a video file, and an audio file.
[0015] Furthermore, the specific steps of generating a game package adapted to the channel through the Gradle plugin according to the channel configuration file, code file, and resource file within the channel in the official Android build process include:
[0016] Load the channel configuration file corresponding to the channel and the channel build configuration file of the remote channel warehouse server;
[0017] Load the dependency libraries and basic resources corresponding to the channel;
[0018] Load the resource compilation directory corresponding to the channel;
[0019] Modify / merge the manifest file to make the generated game package comply with the Android system specifications;
[0020] Modify the compiled bytecode file to make the general channel SDK and the SDK corresponding to the channel seamlessly connected;
[0021] Based on the resource file corresponding to the channel, merge the general SDK and the resources of the channel;
[0022] Generate a game package of the corresponding type for the channel;
[0023] Based on the signature information corresponding to the channel, perform a signature operation on the game package.
[0024] Furthermore, it also includes:
[0025] Before loading the dependency libraries and resource files corresponding to the channels, verify the channel status.
[0026] To achieve the above object, the electronic device provided by this application includes:
[0027] A processor;
[0028] A memory storing one or more computer program instructions to be run on the processor;
[0029] Among them, when the processor runs the computer instructions, it executes the method for generating the channel game package as described above.
[0030] To achieve the above object, the computer-readable storage medium provided by this application stores computer instructions, and when the computer instructions are run by a processor, it executes the steps of the method for generating the channel game package as described above.
[0031] The method for generating the channel game package provided by this application realizes the dynamic construction of different channel game packages through the methods of interface abstraction and Gradle plug-in construction. It no longer requires decompilation and also avoids the problem of complex Smali modification, improving the construction efficiency of the game package.
[0032] Other features and advantages of this application will be described in the subsequent specification, and part of them will become obvious from the specification or be understood by implementing this application. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings are used to provide a further understanding of this application, and constitute a part of the specification. Together with the embodiments of this application, they are used to explain this application and do not constitute a limitation to this application. In the drawings:
[0034] Figure 1 is a schematic flowchart of the method for generating the channel game package of this application;
[0035] Figure 2 is a schematic flowchart of step S105. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0036] The embodiments of this application will be described in more detail below with reference to the drawings. Although some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand this application. It should be understood that the drawings and embodiments of this application are only for exemplary purposes and are not used to limit the protection scope of this application.
[0037] It should be understood that the various steps described in the method embodiments of the present application can be executed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this regard.
[0038] As used herein, the term "including" and its variations are open-ended, that is, "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0039] It should be noted that the modifications of "one" and "multiple" mentioned in the present application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more". "Multiple" should be understood as two or more.
[0040] Next, the embodiments of the present application will be described in detail with reference to the accompanying drawings.
[0041] Embodiment 1
[0042] One embodiment of the present application provides a method for generating a channel game package, which can conveniently and efficiently generate game packages for different channels.
[0043] Figure 1 is a schematic flow chart of the method for generating a channel game package of the present application. Next, reference will be made to Figure 1 to describe the method for generating a channel game package of the present application in detail, including:
[0044] Step S101: Connect the game to the general channel SDK library, and the SDK library constructs an abstract interface including SDK methods for all channels;
[0045] It should be noted that this step S101 aims to unify the calling methods of different channel SDKs, reduce the coupling degree between the main game code and the channel SDK, and the main game project only depends on the general channel SDK library rather than the SDK of a specific channel, thereby laying a foundation for subsequent channel access operations, enabling the interaction between the game and different channel SDKs to be realized through a unified interface specification, and enhancing flexibility and scalability.
[0046] Exemplarily, define a standard interface (such as ChannelSDKInterface) in the general channel SDK library, which includes core methods that all channels must implement. The core methods include initialization, user login, payment, data statistics, etc.
[0047] Exemplarily, whether accessing through Google Play or the Huawei channel, their login functions are called through the login() method, but the specific implementation is completed by each channel itself.
[0048] Step S102: Construct a Gradle script for the configuration parameters of channel packages for several channels;
[0049] It should be noted that the purpose of this step is to manage multi-channel parameters through configuration, so that developers do not need to manually write the build scripts for each channel, but only need to maintain one configuration.
[0050] Exemplarily, as follows:
[0051]
[0052]
[0053] Define a channels configuration block in the Gradle script, list all supported channels (such as Google, Huawei, Xiaomi), and the channel package parameters for each channel at least include the version of the channel SDK, the application name of the channel package, the application ID, and the signature.
[0054] It can be understood that through the Gradle script, game package build tasks can be dynamically generated according to the configuration, providing an automated task-driven mechanism for the subsequent channel package build process.
[0055] Step S103: In response to the Gradle script, automatically generate independent file directories corresponding to each channel, and generate channel configuration files for the channel configuration parameters corresponding to the respective channels in the independent file directories;
[0056] It should be noted that the purpose of this step is to isolate code and resource configurations for each channel to ensure multi-environment compatibility.
[0057] Exemplarily, generate subdirectories (such as src / google) under the project src directory according to the channel names, including the following content:
[0058]
[0059] Among them, the channel parameter configuration file will define channel-specific parameters, for example:
[0060]
[0061] Step S104: Configure the specific code files and resource files corresponding to each channel in the corresponding independent directories.
[0062] The purpose of this step is to achieve personalized customization of the interfaces and functions of different channels. As shown above, the unique Java / Kotlin code and resource files of each channel package will be placed in the corresponding independent directory. These specific codes and resources are highly targeted and only act on the corresponding specific channel package, so as to achieve personalized customization functions and interface presentations for different channels (such as different channels having different splash screens, payment interfaces, and activity pop-ups), fully meeting the diverse channel operation requirements.
[0063] Exemplarily, write channel-specific logic in java / of the independent directory of the channel. For example, add a promotion activity page for the Google channel:
[0064] public class GooglePromotionActivity extends Activity{
[0065] / / Activity page only existing in the Google channel
[0066] };
[0067] It can be understood that through the Source Sets mechanism of Gradle, it is automatically merged into the main project code during compilation, which will not be elaborated here.
[0068] It can be understood that when building the project package, when there are resource files with the same name as the main project (such as ic_launcher.png) in the res / of the channel directory, the resources of the main project will be automatically replaced during building.
[0069] In this embodiment, the resource file includes one of a picture file, a text file, a video file, and an audio file.
[0070] Step S105: In the official Android build process, generate a game package adapted to the channel according to the channel configuration file, code file, and resource file in the channel through the Gradle plugin;
[0071] The purpose of this step is to seamlessly integrate into the official Android build process, generate a compliant channel package, and insert custom logic at the following key stages by registering a hook in the Gradle plugin:
[0072] Manifest file merging; dynamically modify AndroidManifest.xml to add channel-specific permissions or metadata;
[0073] Bytecode modification; Insert the initialization logic of the channel SDK into the compiled code (for example, call ChannelSDK.init() in Application.onCreate()).
[0074] See Figure 2 , and the specific process includes the following steps:
[0075] S201: Load the channel configuration file corresponding to the channel and the channel build configuration file of the remote channel repository server;
[0076] It can be understood that before loading, initialization work will also be carried out, that is, initialize the configuration of the channel. This process includes loading the channel build cache and generating the configuration file, providing the initial data and configuration basis for the entire channel access process.
[0077] In this embodiment, load the channel configuration file defined by the developer to obtain customized parameters such as channel secret keys and package names, and load the channel build configuration file of the remote channel repository server to obtain the default configuration of the channel SDK (such as the minimum SDK version and the list of dependencies) from the remote server.
[0078] S202: Load the dependency libraries and basic resources corresponding to the channel;
[0079] It should be noted that before loading the dependency libraries and basic resources corresponding to the channel, it is also necessary to verify the channel status and carefully check whether all the necessary conditions are met. Only after all conditions are met can the subsequent process be entered. Exemplarily, verify whether the channel ID, signature file hash value, and API key are legal; verify whether the SDK dependency library (such as google-play-services.aar) has been correctly downloaded, etc.
[0080] It can be understood that by parsing the dependency declarations of the channel SDK (such as the Gradle dependencies block), the dependency libraries are dynamically added to the project classpath for loading.
[0081] It can be understood that these dependency libraries and basic resources will be important materials for subsequent resource merging operations, providing strong technical support and resource guarantee for building a channel package with complete functions and adapted to channel characteristics.
[0082] S203: Load the resource compilation directory corresponding to the channel;
[0083] That is, load the resource files and code files in the specific directory corresponding to the channel. These specific files are only applicable to this specific channel, which once again reflects the powerful ability of the present invention to perform personalized customization for different channels.
[0084] It is understandable that through the sourceSets configuration of Gradle, it is ensured that the channel code only corresponds to the current build task.
[0085] S204: Modify / merge the manifest file to make the generated game package comply with the Android system specifications;
[0086] Perform merge / modification operations on the AndroidManifest.xml manifest file during the build process. For example, add corresponding channel permissions and modify key information such as the startup interface according to channel requirements, so that the finally generated channel package can fully display the unique features and functional requirements of the channel while following the Android system specifications.
[0087] S205: Modify the compiled bytecode file to seamlessly connect the common channel SDK and the SDK corresponding to the channel;
[0088] Modify the bytecode file compiled from the project code. Through this operation, the common channel SDK and the channel's SDK are seamlessly connected, ensuring that the game can accurately call the functions and services provided by the channel SDK on different channels, realizing the deep integration and collaborative work between the game and the channel SDK.
[0089] S206: Merge the resources of the common SDK and the channel based on the resource file corresponding to the channel;
[0090] In this embodiment, the overriding principle for merging is that the priority of channel resources is higher than that of the main project resources (for example, res / drawable / icon.png in the main project will be replaced by the file with the same name in the channel). The resources unique to the channel will be directly added, ensuring the consistency and accuracy of the channel package resources and avoiding runtime exceptions caused by resource conflicts.
[0091] S207: Generate a game package of the type corresponding to the channel;
[0092] It is understandable that the generated game package at this time is an unsigned APK package or AAB package.
[0093] S208: Sign the game package based on the signature information corresponding to the channel;
[0094] If a special signature for the channel is set during the configuration process, the signature information of the channel will be preferentially used for signing, so as to ensure that the channel package can reflect the unique identifier and management specifications of the channel while meeting the security verification requirements.
[0095] Embodiment 2
[0096] In this embodiment, an electronic device is further provided, which includes a processor and a memory. The memory is used to store non-transitory computer-readable instructions (such as one or more computer program modules). The processor is used to run the non-transitory computer-readable instructions, and when the non-transitory computer-readable instructions are run by the processor, one or more steps of the above-mentioned method for generating a channel game package can be executed.
[0097] Embodiment 3
[0098] In this embodiment, a computer-readable storage medium is further provided, and the storage medium is used to store non-transitory computer-readable instructions. For example, when the non-transitory computer-readable instructions are executed by a computer, one or more steps of the method for generating a channel game package according to the above can be executed.
[0099] The above description is only for some embodiments of the present application and the description of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features with similar functions disclosed in the present application.
[0100] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present application. Certain features described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, the various features described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0101] Although the subject matter has been described in language specific to structural features and / or methodological acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A method for generating a channel game package, characterized in that, Including: Integrate the game into the general channel SDK library, which constructs an abstract interface including SDK methods for all channels; Construct a Gradle script for the channel package configuration parameters of several channels; In response to the Gradle script, automatically generate independent file directories corresponding to each channel, and generate channel configuration files for the channel configuration parameters corresponding to the respective channels in the independent file directories; Configure specific code files and resource files corresponding to each channel in the corresponding independent directories; In the official Android build process, generate a game package adapted to the channel based on the channel configuration file, code files, and resource files within the channel through the Gradle plugin.
2. The method for generating a channel game package according to claim 1, wherein The channel package configuration parameters at least include the version of the SDK, the application name of the channel package, the application ID, and the signature.
3. The method for generating a channel game package according to claim 1, wherein The SDK methods at least include initialization, login, and payment methods.
4. The method for generating a channel game package according to claim 1, wherein The channel configuration parameters at least include the channel ID and the channel key.
5. The method for generating a channel game package according to claim 1, wherein The resource files at least include one of picture files, text files, video files, and audio files.
6. The method for generating a channel game package according to claim 1, wherein The specific steps of generating a game package adapted to the channel based on the channel configuration file, code files, and resource files within the channel through the Gradle plugin in the official Android build process include: Load the channel configuration file corresponding to the channel and the channel build configuration file of the remote channel repository server; Load the dependency libraries and basic resources corresponding to the channel; Load the resource compilation directory corresponding to the channel; Modify / merge the manifest file to make the generated game package comply with the Android system specifications; Modify the compiled bytecode file to enable seamless connection between the general channel SDK and the SDK corresponding to the channel; Merge the general SDK and the resources of the channel based on the resource files corresponding to the channel; Generate a game package of the corresponding type for the channel; Sign the game package based on the signature information corresponding to the channel.
7. The method for generating a channel game package according to claim 6, wherein Also including: Before loading the dependency libraries and resource files corresponding to the channel, verify the channel status.
8. An electronic device, characterized in that, Including: A processor; A memory storing one or more computer program instructions running on the processor; Wherein, when the processor runs the computer program instructions, it executes the method for generating a channel game package according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, Stored with computer instructions, when the computer instructions run, it executes the steps of the method for generating a channel game package according to any one of claims 1-7.