File format conversion method and device, equipment and medium
By extracting APK file information, dividing and compressing modules, and converting them in AAB format, the problems of cumbersome and inefficient operations during the APK to AAB conversion process are solved, and a more efficient conversion process is achieved.
Patent Information
- Application Number
- CN202510080011.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-19
- Publication Date
- 2025-06-17
AI Technical Summary
The existing conversion method from APK to AAB format is cumbersome, and it is easy to miss modification items, resulting in low conversion efficiency and long-term consumption.
By extracting the file information of the APK file, dividing it into several information modules, compressing these modules according to the content, and finally converting it according to the AAB format to generate a converted file in the AAB format.
The operation process of conversion processing is simplified, omissions and errors are avoided, time-consuming conversion processing is effectively shortened, and conversion efficiency is improved.
Smart Images

Figure CN120162299A_ABST
Abstract
Description
Background Art
[0002] APK (Android Package Kit) is a file type used by Android applications. It is used to install applications on Android hardware (including mobile phones or tablets, multimedia hardware such as Android TV, and sometimes even Wear OS smartwatches). It integrates all the assets, media, and code required to run applications on the Android application system. Compared with file types of other application systems, APK files contain more necessary elements for running and adapting to different screen sizes and orientations.
[0003] With the development and application of different systems, in order to apply files in APK format to different systems, Google has introduced a new release format: Android App Bundle (AAB) format, which can enable applications to run on multiple device configurations (different screen sizes, DPI, CPU architectures), achieving higher flexibility and optimization. Therefore, after developing an APK file, it can be converted into an AAB file. The commonly used conversion method at present is: mainly by modifying the Gradle configuration file and using Android Studio or command-line tools to repackage and apply the content of the APK file, converting the APK file from the APK format to the AAB format.
[0004] However, the commonly used methods at present have the following technical problems: Since the two formats are different, each conversion requires operations on the structure and files of the original APK file. Therefore, each time, the user needs to configure according to the modification items in the AAB format, and then package them one by one according to the configuration items to convert them into the AAB format. The whole process is not only cumbersome to operate, but also prone to missing individual modification items. It needs to be continuously debugged after conversion to complete, resulting in a long processing time and low conversion efficiency. Summary of the Invention
[0005] The present invention provides a method, device, equipment, and medium for converting file formats, which can solve the technical problems of cumbersome operation, low processing efficiency, and easy error in the prior art.
[0006] The first aspect of the embodiments of the present invention provides a method for converting file formats, the method including: After obtaining the file to be converted in APK format, extracting file information from the file to be converted; After dividing the file information into several information modules according to a preset file capacity value, compressing several of the information modules according to the content of the file information to obtain a compressed file; Performing conversion processing on the compressed file according to the AAB format to obtain a converted file in AAB format.
[0007] In combination with the first aspect, in one implementation, extracting file information from the file to be converted includes: Invoking a preset decompilation tool to unpack the file to be converted and obtain the unpacked file; After extracting file resources from the unpacked file, performing verification processing on the file resources, where the file resources include: file content and file directory; When the verification processing passes, extracting file information from the file resources.
[0008] In combination with the first aspect, in one implementation, extracting file information from the file resources includes: Invoking a parsing tool to parse the file resources to obtain parsing information; Extracting information about the storage package name and version number from the parsing information to obtain file information.
[0009] In combination with the first aspect, in one implementation, dividing the file information into several information modules according to a preset file capacity value includes: Obtaining the capacity of the assets resources in the base layer of the file information; Dividing the assets resources capacity into multiple capacity values according to the preset file capacity value, and then splitting the file information into several information modules according to the capacity values.
[0010] In combination with the first aspect, in one implementation, compressing several of the information modules according to the content of the file information to obtain a compressed file includes: If the content of the file information is code, using a parsing tool to compile several of the information modules to obtain compilation information, and then converting the compilation information into a resource middleware and performing compression processing to obtain a compressed file; If the content of the file information is not code, converting several of the information modules into a parsing middleware and performing compression processing to obtain a compressed file.
[0011] In combination with the first aspect, in one implementation, performing conversion processing on the compressed file according to the AAB format to obtain a converted file in the AAB format includes: Invoking a preset compression tool to compress the compressed file according to the AAB format and outputting the compressed file to a preset path to obtain a converted file in the AAB format.
[0012] In combination with the first aspect, in one implementation, after the step of performing conversion processing on the compressed file according to the AAB format to obtain a converted file in the AAB format, the method further includes: Sign the converted file using a signature tool and transmit the signature of the converted file to a preset path. The signature includes: path signature, file alias signature, file password signature, and alias password signature.
[0013] The second aspect of the embodiments of the present invention provides a device for converting file formats. The device includes: An extraction module, configured to extract file information from the file to be converted in APK format after obtaining the file to be converted. A compression module, configured to divide the file information into several information modules according to a preset file capacity value, and then compress the several information modules according to the content of the file information to obtain a compressed file. A conversion module, configured to perform a conversion process on the compressed file in AAB format to obtain a converted file in AAB format.
[0014] Combined with the second aspect, in one implementation, the extracting file information from the file to be converted includes: Call a preset decompilation tool to unpack the file to be converted and unpack the file. After extracting the file resources from the unpacked file, perform a verification process on the file resources. The file resources include: file content and file directory. When the verification process passes, extract file information from the file resources.
[0015] Combined with the second aspect, in one implementation, the extracting file information from the file resources includes: Call a parsing tool to parse the file resources to obtain parsing information. Extract information about the storage package name and version number from the parsing information to obtain file information.
[0016] Combined with the second aspect, in one implementation, the dividing the file information into several information modules according to a preset file capacity value includes: Obtain the assets resource capacity of the base layer of the file information. Divide the assets resource capacity into multiple capacity values according to a preset file capacity value, and then split the file information into several information modules according to the capacity values.
[0017] Combined with the second aspect, in one implementation, the compressing the several information modules according to the content of the file information to obtain a compressed file includes: If the content of the file information is code, use a parsing tool to compile the several information modules to obtain compilation information, and then convert the compilation information into a resource middleware and perform a compression process to obtain a compressed file. If the content of the file information is not code, convert several of the information modules into a parsing middleware and perform compression processing to obtain a compressed file.
[0018] Combined with the second aspect, in one implementation, the step of converting the compressed file in the AAB format to obtain a converted file in the AAB format includes: Call a preset compression tool to compress the compressed file in the AAB format, and output the compressed file to a preset path to obtain a converted file in the AAB format.
[0019] Combined with the second aspect, in one implementation, the device further includes: A signature module, configured to, after the step of converting the compressed file in the AAB format to obtain a converted file in the AAB format, use a signature tool to sign the converted file, and transmit the signature of the converted file to a preset path, where the signature includes: a path signature, a file alias signature, a file password signature, and an alias password signature.
[0020] Compared with the prior art, a file format conversion method, device, equipment, and medium provided by an embodiment of the present invention have the beneficial effects that: after obtaining a file to be converted in the APK format, the present invention can automatically extract file information from the file to be converted; divide the file information into several information modules according to a preset file capacity value, and compress the several information modules according to the content of the file information to obtain a compressed file; finally, convert the compressed file in the AAB format to obtain a converted file in the AAB format. It can not only simplify the operation process of conversion processing, but also avoid omissions and errors, effectively shorten the time-consuming of conversion processing, and improve conversion efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a flowchart of a file format conversion method provided by an embodiment of the present invention; Figure 2 is an operation flowchart of a file format conversion method provided by an embodiment of the present invention; Figure 3 is a structural schematic diagram of a file format conversion device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without making creative efforts belong to the scope of protection of the present invention.
[0023] APK (Android Package Kit) is a file type used by Android applications. It is used to install applications on Android hardware (including mobile phones or tablets, multimedia hardware such as Android TV, and sometimes even Wear OS smart watches). It integrates all the assets, media, and code required to run an application on the Android application system. Compared with the file types of other application systems, the APK file contains more necessary elements for running and adapting to different screen sizes and orientations.
[0024] With the development and application of different systems, in order to apply files in APK format to different systems, Google has introduced a new release format: Android App Bundle (AAB) format, which can enable applications to run on a variety of device configurations (different screen sizes, DPI, CPU architectures), achieving higher flexibility and optimization. Therefore, after developing an APK file, it can be converted into an AAB format file. The currently common conversion method is: mainly by modifying the Gradle configuration file and using Android Studio or command-line tools to repackage and apply the content of the APK file, converting the APK file from the APK format to the AAB format.
[0025] However, the currently common methods have the following technical problems: Since the two formats are different, each conversion requires modifying the structure and files of the original APK file. Therefore, each time the user needs to configure according to the modification items in the AAB format, and then package them one by one according to the configuration items to convert them into the AAB format. The whole process is not only cumbersome to operate, but also prone to missing individual modification items. After conversion, continuous debugging is required to complete, which takes a long time and has low conversion efficiency.
[0026] To solve the above problems, the following specific embodiments will be used to introduce and explain in detail a file format conversion method, device, device, and medium provided in the embodiments of the present application.
[0027] Refer to Figure 1 , which shows a schematic flowchart of a file format conversion method provided by an embodiment of the present invention.
[0028] In one embodiment, the file format conversion method is applicable to an automatic conversion platform or an automatic conversion tool.
[0029] Among them, as an example, the file format conversion method may include the following sub-steps: S11. After obtaining the file to be converted in APK format, extract file information from the file to be converted.
[0030] In one embodiment, the automatic conversion platform can obtain the file to be converted in APK format. Specifically, it can be that the user uploads the file to be converted in APK format to the automatic conversion platform.
[0031] After obtaining the file to be converted in APK format, relevant information can be extracted from the file to be converted to obtain file information.
[0032] In one embodiment, file information can be extracted from the file to be converted by means of parsing, compiling, reading, etc. The file information may include all assets, media, code, directories, addresses, etc. required by the application corresponding to the file to be converted.
[0033] In an alternative embodiment, since the file to be converted in APK format is a file package obtained by the user through configuration, packaging, and compilation, in order to quickly extract the required file information from the compiled file to be converted in APK format, among them, as an example, the extracting file information from the file to be converted may include the following sub-steps: S111. Call a preset decompilation tool to unpack the file to be converted and unpack the file.
[0034] S112. After extracting file resources from the unpacked file, perform verification processing on the file resources, where the file resources include: file content and file directory.
[0035] S113. When the verification processing passes, extract file information from the file resources.
[0036] In specific operations, a decompilation tool (such as Apktool) can be called to unpack the file to be converted in APK format. Among them, the command line for unpacking can be as follows: apktool d the APK to be decompiled -o the folder output path.
[0037] After obtaining the unpacked file, the file resources of the unpacked file can be extracted. Among them, the file resources include file content and file directories, specifically including: classes.dex, res directory, assets directory, kotlin directory, and AndroidManifest.xml, etc. After obtaining the above file content and file directories, verification processing can be performed on them to verify the integrity of the extracted files and directories and ensure that all content has been correctly extracted. When the verification processing passes, file information can be obtained from the file content related to the file content and file directories.
[0038] In one operation mode, the verification processing can include the following steps: First step, obtain the verification processing request input by the user; the verification processing request includes verification execution operation information, user authentication information, and a marker information; the marker information is a flag bit obtained by signing the verification execution operation information and the user authentication information with a private key; the user authentication information includes identity identification information, a first indication information, and a public key matching the private key.
[0039] Second step, when the marker information passes the verification of the public key, obtain the verification list associated with the identity identification information from the blockchain; the verification list includes multiple configuration contents pre-written by the user.
[0040] Third step, first determine whether the user authentication information is valid. If the user authentication information is the same as the preset authentication information, it is determined that the user authentication information is valid; otherwise, it is determined that the user authentication information is invalid.
[0041] Fourth step, when it is determined that the user authentication information is valid, the fields of the file resources can be compared one by one with the fields of the configuration contents of the verification list. If the fields of the file resources are different from the fields of the configuration contents of the verification list, it is determined that the verification fails. If the fields of the file resources are the same as the fields of the configuration contents of the verification list system, it is determined that the verification passes.
[0042] In another operation mode, the verification processing can include the following steps: First step, extract multiple file fields from the file resources according to the preset title fields. The file fields can include: fields of file content and fields of file directories.
[0043] Second step, if the file field is a numerical value, determine whether the numerical value of the file field is within the preset numerical range; if the file field is a character, determine whether the character of the file field is the same as the preset character.
[0044] Third step, if the numerical value of the file field is within the preset numerical range or the character of the file field is the same as the preset character, it can be determined that the verification passes.
[0045] In the fourth step, if the value of the file field is not within the preset value range or the character of the file field is different from the preset character, it can be determined that the verification fails.
[0046] By decompiling the file to be converted in APK format, file information such as the code (Dex file), resources (resource files and resource directories), and configuration information (such as the Manifest file) can be extracted from the file to be converted in APK format. Subsequently, conversion can be performed based on the file information so that the file to be converted in APK format can be converted into a file in AAB format.
[0047] In an optional embodiment, the file content and file directory may be files packaged by the user through an encoder or a packaging device. In order to quickly extract the file content and file directory of the packaged files, wherein, by way of example, the extracting file information from the file resources may include the following sub-steps: S1131. Invoke a parsing tool to parse the file resources to obtain parsing information.
[0048] S1132. Extract information about the stored package name and version number from the parsing information to obtain file information.
[0049] In an operation mode, a parsing tool (such as the aapt2 parsing tool) can be used to parse the file structure of the file resources. For example, the parsing tool can be invoked to parse the "AndroidManifest.xml" file of the file resources to obtain parsing information. The specific parsing command can be as follows: aapt2 dump badging the path of the APK to be parsed. Then, information such as the package name and version number can be obtained from the parsing information. Specifically, key information such as the package name and version number can be extracted and stored to obtain file information.
[0050] S12. After dividing the file information into several information modules according to a preset file capacity value, compress several of the information modules according to the content of the file information to obtain a compressed file.
[0051] In an embodiment, after obtaining the file information, the capacity of the file information may be large, and processing the file information takes a long time and has low efficiency. In order to shorten the processing time, the file information can be first split into multiple different information modules. Then, several information modules can be processed in parallel, and multiple information modules can be processed uniformly, thereby shortening the processing time.
[0052] In order to further accelerate the conversion efficiency, several information modules can be compressed according to the content of the file information to obtain a compressed file, and then format conversion can be performed after compression to improve the processing efficiency.
[0053] In one of the embodiments, in order to perform compression processing by combining the actual capacity of the file and the processing capacity of the automatic conversion platform, as an example, dividing the file information into several information modules according to a preset file capacity value may include the following sub-steps: S121. Obtain the assets resource capacity of the base layer of the file information.
[0054] S122. Divide the assets resource capacity into multiple capacity values according to the preset file capacity value, and then split the file information into several information modules according to the capacity values.
[0055] Specifically, obtain the assets resource capacity of the base layer of the file information. Determine whether the assets resource capacity is greater than the preset file capacity value (for example, 150MB). If the assets resource capacity is less than the preset file capacity value (for example, 150MB), the file information can be used as one information module.
[0056] If the assets resource capacity is greater than the preset file capacity value (for example, 150MB), 150MB of the content of the file information can be used as one information module, and the remaining file content is divided by 150MB until the file information is completely divided, so that several information modules can be obtained.
[0057] By dividing several information modules, subsequent processing of several information modules can be performed in parallel, thereby shortening the processing time and improving the overall processing efficiency.
[0058] In one of the embodiments, in order to further reduce the amount of processed data to achieve fast format conversion processing, as an example, compressing several of the information modules according to the content of the file information to obtain a compressed file may include the following sub-steps: S123. If the content of the file information is code, use a parsing tool to compile several of the information modules to obtain compilation information, and then convert the compilation information into a resource middleware and perform compression processing to obtain a compressed file.
[0059] S124. If the content of the file information is not code, convert several of the information modules into a parsing middleware and perform compression processing to obtain a compressed file.
[0060] During actual operation, it can be determined whether the content of the file information is code. If the content of the file information is code, after using a parsing tool to compile several of the information modules to obtain compilation information, the compilation information is converted into a resource middleware and compressed to obtain a compressed file. Specifically, the aapt2 parsing tool can be used to recompile the res files of several information modules of the file information to obtain compilation information. By using comliled_resources.zip and other resources to generate a resource intermediate product (for example, base.apk) from the compilation information, and then compressing the resource intermediate product to obtain a compressed file.
[0061] Similarly, if the content of the file information is not code, several information modules are converted into a parsing middleware and compressed to obtain a compressed file. Specifically, assets and AndroidManifest.xml can be used to convert several information modules into a parsing middleware, or it can be base.apk. base.apk can be used to generate the resource product of Assetpack. After compressing the parsing middleware, a compressed file is obtained.
[0062] In specific operations, the compression process can be to compress the file to prepare for generating an AAB file later. The specific operation steps can use the zip tool to compress the file directories of the base and install_time_assets modules into a ZIP format file to obtain a compressed file.
[0063] S13. Perform a conversion process on the compressed file in the AAB format to obtain a converted file in the AAB format.
[0064] In one embodiment, after obtaining the compressed file, a conversion process can be performed on the compressed file in the AAB format to obtain a converted file in the AAB format.
[0065] Specifically, a format converter can be used for conversion to obtain a converted file in the AAB format, or the compressed file can be packaged in the AAB format to obtain a converted file in the AAB format.
[0066] Among them, as an example, the performing a conversion process on the compressed file in the AAB format to obtain a converted file in the AAB format may include the following sub-steps: S131. Call a preset compression tool to compress the compressed file in the AAB format, and output the compressed file to a preset path to obtain a converted file in the AAB format.
[0067] In one operation mode, an existing tool can be used to package the compressed file into the AAB format. The specific operation steps can use Google's bundletool to package the compressed file into an AAB file. The operation command line for packaging and conversion is as follows: bundletool.jar build-bundle --modules=path of all module compressed packages --output=path of AAB output.
[0068] In one embodiment, after generating the conversion file in the AAB format, the user needs to install it and needs to verify it to avoid installation errors. To facilitate the user to verify the conversion file in the AAB format, for example, after the step of converting the compressed file into the conversion file in the AAB format, the method may further include the following sub-steps: S14. Sign the conversion file using a signature tool and transmit the signature of the conversion file to a preset path. The signature includes: path signature, file alias signature, file password signature, and alias password signature.
[0069] Specifically, a signature tool can be used to sign the conversion file in the AAB format and transmit the signature of the conversion file to a preset path. The signature includes: path signature, file alias signature, file password signature, and alias password signature.
[0070] Specifically, a conversion file in the AAB format can be generated and signed first to ensure that it can pass the verification of Google Play and be correctly distributed and installed.
[0071] The specific operation steps can use the apksigner tool to sign the conversion file in the AAB format because Google must use a signature method of v2 or above. The signature command line is as follows: apksigner.bat path sign --ks signature file path --ks-key-alias alias of the signature file --ks-pass pass:password of the signature file --key-pass pass:password of the alias --min-sdk-version 21 --out output path of the signed AAB path of the unsigned AAB. Finally, each signature is transmitted to a preset path, and subsequent installation processing can be performed according to the signature of the file.
[0072] Since the original APK-format file to be converted contains all the assets, media, and code required to run an application on the Android application system. To further verify whether there are deviations between the generated AAB-format file and the APK-format file, for example, after the step of obtaining the converted AAB-format file, the method may further include: First, extract the first file parameters from the converted AAB-format file and the second file parameters from the APK-format file to be converted. Both file parameters may include: all the assets, media, and code required for the application.
[0073] Second, compare whether the first file parameters and the second file parameters are the same. If the first file parameters and the second file parameters are the same, transfer the converted AAB-format file to the corresponding address for the user to obtain.
[0074] Third, if the first file parameters and the second file parameters are different, obtain the difference parameters from the second file parameters, use the difference parameters to replace the corresponding parameter content of the first file parameters, and repackage after the replacement to obtain the AAB-format file.
[0075] By comparing the parameters, it can be further determined whether there is an error in the file conversion, avoiding the user from installing with an incorrect file package.
[0076] In an optional embodiment, the subsequent user may need to extract the converted file for application installation processing. To facilitate the user to extract the converted AAB-format file for application installation, for example, the method may further include the following steps: S15. Obtain the device name of the target device, and find the corresponding communication process and communication protocol from the preset communication list according to the device name.
[0077] S16. Search for the corresponding communication fields according to the communication fields of the communication protocol. The communication fields include the address and the field content required for the request.
[0078] S17. Build multiple communication threads based on the communication process, and build a communication request according to the communication fields.
[0079] S18. Adaptively adjust the communication threads according to the current network condition, communicate with the target device according to the adjusted communication threads and the communication request, and transfer the converted AAB-format file to the target device for the target device to perform installation processing.
[0080] In one embodiment, the user can pre-record the names of multiple devices that can install the conversion files in AAB format, and record the communication processes and communication protocols corresponding to each device name to construct a communication list. After obtaining the device name of the target device, the corresponding communication process and communication protocol can be found in the communication list according to the device name.
[0081] Next, the corresponding communication fields can be searched according to the communication fields of the communication protocol. The communication fields include the address and the field content required for the request. Thus, the interface address of the target device can be determined according to the communication fields, and the format of the communication request can be constructed to facilitate the generation of the communication request. Since the communication protocols of different devices are different, the two parties may need to interact multiple times to send the file. For this reason, multiple communication threads can be constructed in advance according to the communication process, each thread corresponding to an interaction step. At the same time, the communication requests for the communication between the two parties can be constructed according to the communication fields.
[0082] Finally, the network status of the automatic conversion platform can be obtained, and then the communication threads can be adaptively adjusted according to the current network status. Finally, communicate with the target device according to the adjusted communication threads and communication requests, and transfer the conversion files in AAB format to the target device for installation processing by the target device.
[0083] Among them, the adaptive adjustment can be to adjust the parameters of the thread. For example, adjust the communication duration of the thread, the communication waiting duration, the execution duration of the thread, the sending interval duration of the thread, the bandwidth occupied by the thread, the computing resources that the thread can call, and so on.
[0084] Specifically, it can be adjusted according to actual needs. It can be that the user inputs some adjustment parameters of the thread, and then replaces the parameters of the thread with the parameters input by the user.
[0085] Refer to Figure 2 , which shows the operation flowchart of a file format conversion method provided by an embodiment of the present invention.
[0086] Specifically, the operations of the file format conversion method may include the following operations: The first step is to decompile the APK format file after obtaining the file in APK format.
[0087] The second step is to extract the file information from the decompiled APK format file.
[0088] The third step is to divide the asset resources of the file information into module folders to obtain several module files.
[0089] Step 4: If the content of the file information is code, use the aapt2 parsing tool to recompile the res files of several information modules of the file information to obtain compilation information; then generate a resource intermediate product (e.g., base.apk) from the compiled_resources.zip and other resources, and perform compression processing on the resource intermediate product to obtain a compressed file. If the content of the file information is not code, use assets and AndroidManifest.xml to convert several information modules into a parsing middleware, which can also be base.apk. base.apk can be used to generate the resource product of Assetpack; perform compression processing on the parsing middleware to obtain a compressed file.
[0090] Step 5: Package the compressed file into a file in AAB format.
[0091] Step 6: Sign the file in AAB format.
[0092] Performing conversion processing through an automated tool or automated platform can simplify the work process, avoid manual repetitive work, and significantly improve work efficiency. Developers do not need to manually unpack, package, and sign. They only need to perform simple operations to complete the conversion; they can also quickly complete the conversion task to meet the requirements of rapid iteration and release. Through in-depth APK parsing and accurate resource reorganization, it is ensured that no resources will be lost or functional incompatibilities will occur during the conversion process. Moreover, the automated signing process reduces the chance of errors and ensures that the generated AAB file can pass the verification of Google Play correctly.
[0093] In this embodiment, the present invention provides a method for converting file formats, and its beneficial effects are as follows: After obtaining the file to be converted in APK format, the present invention can automatically extract file information from the file to be converted; divide the file information into several information modules according to a preset file capacity value, and compress the several information modules according to the content of the file information to obtain a compressed file; finally, perform conversion processing on the compressed file in AAB format to obtain a converted file in AAB format. It can not only simplify the operation process of conversion processing, but also avoid omissions and errors, and can effectively shorten the time-consuming of conversion processing and improve conversion efficiency.
[0094] The embodiment of the present invention also provides a device for converting file formats. Refer to Figure 3 , which shows a schematic structural diagram of a device for converting file formats provided by an embodiment of the present invention.
[0095] Among them, by way of example, the device for converting file formats may include: An extraction module 301, configured to extract file information from the file to be converted after obtaining the file to be converted in APK format; A compression module 302, configured to divide the file information into several information modules according to a preset file capacity value, and then compress the several information modules according to the content of the file information to obtain a compressed file; A conversion module 303, configured to perform conversion processing on the compressed file in AAB format to obtain a converted file in AAB format.
[0096] Optionally, the extracting file information from the file to be converted includes: Invoking a preset decompilation tool to unpack the file to be converted to obtain an unpacked file; After extracting file resources from the unpacked file, performing verification processing on the file resources, where the file resources include: file content and file directory; When the verification processing passes, extracting file information from the file resources.
[0097] Optionally, the extracting file information from the file resources includes: Invoking a parsing tool to parse the file resources to obtain parsing information; Extracting information about the storage package name and version number from the parsing information to obtain file information.
[0098] Optionally, the dividing the file information into several information modules according to a preset file capacity value includes: Obtaining the assets resource capacity of the base layer of the file information; Dividing the assets resource capacity into multiple capacity values according to a preset file capacity value, and then splitting the file information into several information modules according to the capacity values.
[0099] Optionally, the compressing the several information modules according to the content of the file information to obtain a compressed file includes: If the content of the file information is code, using a parsing tool to compile the several information modules to obtain compilation information, and then converting the compilation information into a resource middleware and performing compression processing to obtain a compressed file; If the content of the file information is not code, converting the several information modules into a parsing middleware and performing compression processing to obtain a compressed file.
[0100] Optionally, the performing conversion processing on the compressed file in AAB format to obtain a converted file in AAB format includes: Call the preset compression tool to compress the compressed file in the AAB format, and output the compressed file to the preset path to obtain a converted file in the AAB format.
[0101] Optionally, the device further includes: A signature module, configured to, after the step of converting the compressed file in the AAB format to obtain a converted file in the AAB format, use a signature tool to perform a signature process on the converted file, and transmit the signature of the converted file to a preset path, where the signature includes: a path signature, a file alias signature, a file password signature, and an alias password signature.
[0102] Those skilled in the art can clearly understand that for the convenience of description and simplicity, the specific working process of the device described above can refer to the corresponding process in the foregoing method embodiment, and will not be elaborated herein.
[0103] Further, an embodiment of the present application further provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the program, it implements the file format conversion method as described in the foregoing embodiment.
[0104] Further, an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to cause a computer to execute the file format conversion method as described in the foregoing embodiment.
[0105] In the description of the embodiments of the present invention, it should be noted that the orientation or positional relationship indicated by terms such as "upper", "lower", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the embodiments of the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation to the present invention. When an element such as a layer, region, or substrate is referred to as "on" or "above" another element, it can be directly on that other element, or there can also be an intermediate element. On the contrary, when an element is referred to as "directly on" or "above" another element, there is no intermediate element. It should also be understood that when an element is referred to as "under" or "below" another element, it can be directly under or below that other element, or there can also be an intermediate element. On the contrary, when an element is referred to as "directly under" or "below" another element, there is no intermediate element. Unless otherwise clearly specified and limited, the terms "mounted", "connected", and "coupled" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0106] Those skilled in the art should understand that the embodiments of the present application may also provide a computer program product. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0107] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), devices, and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0108] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one or more of the processes and / or blocks Figure 1 one or more of the processes and / or blocks Figure 1 specified in the function.
[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one or more of the processes and / or blocks Figure 1 one or more of the processes and / or blocks Figure 1 specified in the steps of the function.
[0110] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the technical principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A method for converting a file format, characterized in that: The method comprises: After obtaining the file to be converted in APK format, extracting file information from the file to be converted; After dividing the file information into a plurality of information modules according to a preset file capacity value, compressing the plurality of information modules according to the content of the file information to obtain a compressed file; The compressed file is converted according to the AAB format to obtain a converted file in the AAB format.
2. The file format conversion method according to claim 1, characterized in that: The step of extracting file information from the file to be converted comprises: Calling a preset decompilation tool to unpack the file to be converted, unpacking the file; After extracting the file resources from the unpacked file, verifying the file resources, the file resources include: file content and file directory; When the verification process is passed, the file information is extracted from the file resource.
3. The file format conversion method according to claim 2, characterized in that: The extracting file information from the file resource comprises: Calling a parsing tool to parse the file resource and obtain parsing information; The file information is obtained by extracting information about the storage package name and version number from the parsed information.
4. The file format conversion method according to claim 1, characterized in that: The file information is divided into a plurality of information modules according to the preset file capacity value, including: Get the assets resource capacity of the base layer of the file information; The assets resource capacity is divided into a plurality of capacity values according to a preset file capacity value, and then the file information is split into a plurality of information modules according to the capacity value.
5. The file format conversion method according to claim 1, characterized in that: The step of compressing a plurality of information modules according to the content of the file information to obtain a compressed file comprises: If the content of the file information is code, a parsing tool is used to compile a number of the information modules to obtain compiled information, and then the compiled information is converted into resource middleware and compressed to obtain a compressed file; If the content of the file information is not code, several of the information modules are converted into parsing middleware and compressed to obtain a compressed file.
6. The file format conversion method according to claim 1, characterized in that: The step of converting the compressed file according to the AAB format to obtain a converted file in the AAB format includes: A preset compression tool is called to compress the compressed file in AAB format, and the compressed file is output to a preset path to obtain a converted file in AAB format.
7. The method for converting a file format according to any one of claims 1 to 6, characterized in that: After the step of converting the compressed file according to the AAB format to obtain a converted file in the AAB format, the method further includes: The conversion file is signed using a signature tool, and the signature of the conversion file is transmitted to a preset path, wherein the signature includes: a path signature, a file alias signature, a file password signature, and an alias password signature.
8. A file format conversion device, characterized in that: The device comprises: An extraction module, configured to extract file information from the file to be converted after obtaining the file to be converted in APK format; A compression module, used for dividing the file information into a plurality of information modules according to a preset file capacity value, and compressing the plurality of information modules according to the content of the file information to obtain a compressed file; The conversion module is used to convert the compressed file according to the AAB format to obtain a converted file in the AAB format.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the file format conversion method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the file format conversion method according to any one of claims 1 to 7.