Installation package volume optimization method, device, electronic device and storage medium

By decompiling and deleting similar pictures, and using multiple image similarity algorithms to optimize Android installation packages, the problem of excessive size of Android installation packages is solved, and download efficiency and user retention rate are improved.

CN111538503BActive Publication Date: 2024-12-31BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010231591.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-27
Publication Date
2024-12-31
Estimated Expiration
2040-03-27

AI Technical Summary

Technical Problem

When optimizing the volume of Android installation packages in the prior art, common methods such as mass compression, size compression, sampling rate compression, etc. will lead to clarity problems, which will not effectively reduce the installation package volume, affecting the user's installation success rate and retention rate.

Method used

By detecting and optimizing the Android installation package, decompile the installation package, traverse the pictures, judge and delete similar pictures, and use multiple image similarity algorithms (such as picture normalization processing, European-style distance judgment, outline judgment, and main color judgment) to determine and delete redundant similar pictures.

Benefits of technology

It effectively reduces the volume of Android installation package, improves the download efficiency of the application and user retention rate, and solves the download pressure problem caused by excessive installation package size.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111538503B_ABST
    Figure CN111538503B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an optimization method, device, electronic device and storage medium for the size of an installation package, wherein the method comprises: detecting an optimization instruction for optimizing an Android installation package APK; decompiling the APK according to the optimization instruction to obtain all images in the APK; traversing all images to detect similar images among all images; and deleting redundant images among the similar images. That is, in the present disclosure, when an optimization instruction for optimizing an Android installation package APK is detected, all images in the APK are obtained by decompiling the APK, and then traversing all images to detect similar images, and deleting redundant images among the similar images. That is, by deleting similar images in the Android installation package, the size of the Android installation package is optimized, thereby reducing the download pressure of the application and improving the download efficiency of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of application development technology, and in particular to a method, device, electronic device and storage medium for optimizing the volume of an installation package. Background Art

[0002] With the rapid iteration of business, new business logic codes, image resources and third-party software development kits (SDK Software Development Kit) are constantly introduced into applications (APPs), which directly leads to the continuous increase in the size of Android installation packages (APKs), which brings more and more problems, such as low user installation success rate, and even affects user retention rate. Common technologies for optimizing the size of Android installation packages (referred to as installation packages) include: Zip format optimization, image resource optimization, etc.

[0003] In the related art, the optimization of image resources in the installation package usually adopts: quality compression, size compression, sampling rate compression, LibJpeg compression, etc. to achieve the purpose of reducing the size of the images in the installation package. However, no matter which of the above optimization methods is used, there will be more or less clarity problems.

[0004] Therefore, how to effectively optimize the image size in the installation package is a technical problem that needs to be solved. Summary of the invention

[0005] The present disclosure provides a method, device, electronic device and storage medium for optimizing the size of an installation package, so as to at least solve the technical problem of excessively large installation package size in the related art. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a method for optimizing the volume of an installation package is provided, comprising:

[0007] Detected optimization instructions for optimizing the Android installation package APK;

[0008] Decompile the APK according to the optimization instruction to obtain all images in the APK;

[0009] Traverse all pictures and detect similar pictures among all pictures;

[0010] Delete redundant pictures from the similar pictures.

[0011] Optionally, traversing all pictures and detecting similar pictures among all pictures includes:

[0012] It is determined whether the similarity between all pictures meets a preset threshold. If so, the pictures meeting the preset threshold are determined to be similar pictures.

[0013] Optionally, determining whether the similarity between all images meets a preset threshold includes:

[0014] Use N preset image similarity algorithms to determine whether the similarities between all images meet corresponding preset thresholds; where N is a natural number greater than or equal to 2.

[0015] Optionally, before using N kinds of picture similarity algorithms to determine whether the similarities between all pictures meet corresponding preset thresholds, the method further includes:

[0016] The preset N kinds of picture similarity algorithms are sorted to obtain N! sorting sequences.

[0017] Optionally, the using of preset N kinds of picture similarity algorithms to determine whether the similarities between all pictures meet corresponding preset thresholds specifically includes:

[0018] Select any one sorting sequence from the N! sorting sequences;

[0019] The first picture similarity algorithm of the selected sorting sequence is used to determine whether the similarity between all pictures meets the corresponding preset threshold, and the subsequent picture similarity algorithms in the sorting sequence are used in turn to iteratively determine the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, until the last picture similarity algorithm of the sorting method is used to determine the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, so as to obtain the final similar pictures.

[0020] Optionally, the preset N image similarity algorithms include at least the following two: an image normalization processing algorithm, an image Euclidean distance judgment algorithm, an image contour judgment algorithm and an image main color judgment algorithm.

[0021] Optionally, deleting redundant pictures from the similar pictures includes:

[0022] Comparing the volume of each of the similar pictures;

[0023] Delete the large pictures among the similar pictures.

[0024] Optionally, after determining similar pictures among all pictures, the method further includes:

[0025] showing the similar pictures to an operator;

[0026] detecting a deletion instruction input by the operator;

[0027] According to the deletion instruction, the corresponding picture in the similar pictures is deleted.

[0028] According to a second aspect of an embodiment of the present disclosure, a device for optimizing the volume of an installation package is provided, comprising:

[0029] The first detection module is configured to execute an optimization instruction for detecting and optimizing an Android installation package APK;

[0030] A decompilation module is configured to execute decompilation of the APK according to the optimization instruction to obtain all images in the APK;

[0031] The traversal module is configured to perform a traversal of all images and detect similar images among all images;

[0032] The first deleting module is configured to delete redundant pictures from the similar pictures.

[0033] Optionally, the traversal module includes:

[0034] A determination module is configured to determine whether the similarity between all images meets a preset threshold;

[0035] The determination module is configured to determine that the pictures meeting the preset threshold are similar pictures when the determination module determines that the similarities between all pictures meet the preset threshold.

[0036] Optionally, the judgment module is specifically configured to execute N kinds of image similarity algorithms to judge whether the similarities between all images meet corresponding preset thresholds; wherein N is a natural number greater than or equal to 2.

[0037] Optionally, the device further comprises:

[0038] The sorting module is configured to sort the preset N kinds of picture similarity algorithms to obtain N! sorting sequences before the judging module uses the N kinds of picture similarity algorithms to judge whether the similarities between all pictures meet the corresponding preset thresholds.

[0039] Optionally, the judging module includes:

[0040] A selection module is configured to select any one of the N! sorting sequences obtained by sorting the sorting module;

[0041] The iterative judgment module is configured to execute the first picture similarity algorithm of the sorting sequence selected by the selection module to judge whether the similarity between all pictures meets the corresponding preset threshold; sequentially use the subsequent picture similarity algorithm in the sorting sequence to iteratively judge the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, until the last picture similarity algorithm of the sorting sequence is used to judge the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, so as to obtain the final similar pictures.

[0042] Optionally, the judgment module uses N picture similarity algorithms including at least the following two:

[0043] Image normalization processing algorithm, image Euclidean distance judgment algorithm, image contour judgment algorithm and image main color judgment algorithm.

[0044] Optionally, the first deletion module includes:

[0045] A comparison module is configured to compare the volume of each image in the similar images;

[0046] The picture deleting module is configured to delete the pictures with large volume among the similar pictures.

[0047] Optionally, the device further comprises:

[0048] A display module, configured to display the similar pictures to the user after the traversal module detects similar pictures among all pictures;

[0049] A second detection module is configured to execute a deletion instruction detected to be input by the user;

[0050] The second deleting module is configured to execute the deleting instruction to delete the corresponding picture in the similar pictures.

[0051] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing processor executable instructions; wherein the processor is configured to execute the instructions to implement any one of the installation package volume optimization methods described above.

[0052] According to the fourth aspect of an embodiment of the present disclosure, a storage medium is provided. When the instructions in the storage medium are executed by a processor of an installation package volume optimization device or an electronic device, the installation package volume optimization device or the electronic device can execute any one of the installation package volume optimization methods described above.

[0053] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided. When instructions in the computer program product are executed by a processor of an installation package volume optimization device or an electronic device, the installation package volume optimization device or the electronic device performs any one of the installation package volume optimization methods described above.

[0054] The technical solution provided by the embodiments of the present disclosure may at least include the following beneficial effects:

[0055] The method for optimizing the size of the installation package shown in this exemplary embodiment detects an optimization instruction for optimizing the Android installation package APK; decompiles the APK according to the optimization instruction to obtain all the images in the APK; traverses all the images to obtain similar images among all the images; and deletes redundant images among the similar images. That is to say, in the present disclosure, when an optimization instruction for optimizing the Android installation package APK is detected, all the images in the APK are obtained by decompiling the APK, and then traversing all the images, similar images are detected, and redundant images among the similar images are deleted. That is, by deleting similar images in the Android installation package, the size of the Android installation package is optimized, thereby reducing the download pressure of the application and improving the download efficiency of the application.

[0056] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0058] Figure 1 The figure is a flow chart of a method for optimizing the size of an installation package according to an exemplary embodiment.

[0059] Figure 2 is another flow chart of a method for optimizing the volume of an installation package according to an exemplary embodiment.

[0060] Figure 3 The figure is a block diagram of a device for optimizing the volume of an installation package according to an exemplary embodiment.

[0061] Figure 4 is another block diagram of a device for optimizing the volume of an installation package according to an exemplary embodiment.

[0062] Figure 5 It is another block diagram of a device for optimizing the volume of an installation package according to an exemplary embodiment.

[0063] Figure 6 The figure is a block diagram of a first deletion module according to an exemplary embodiment.

[0064] Figure 7 It is another block diagram of a device for optimizing the volume of an installation package according to an exemplary embodiment. DETAILED DESCRIPTION

[0065] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0066] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0067] Figure 1 is a flow chart of a method for optimizing the size of an installation package according to an exemplary embodiment. Figure 1 As shown, the method for optimizing the size of the installation package is used in a terminal, and includes the following steps.

[0068] In step 101, an optimization instruction for optimizing an Android installation package (APK, Android Package) is detected;

[0069] In step 102, the APK is decompiled according to the optimization instruction to obtain all images in the APK;

[0070] In step 103, all pictures are traversed to detect similar pictures among all pictures;

[0071] In step 104, redundant pictures among the similar pictures are deleted.

[0072] The file generation method disclosed in the present invention can be applied to terminals, servers, etc., without limitation herein, and its terminal implementation device can be a smart phone, a laptop computer, a tablet computer, and other electronic devices, without limitation herein.

[0073] Combine the following Figure 1 , the specific implementation steps of a file generation method provided by an embodiment of the present disclosure are described in detail.

[0074] First, executing step 101, detecting an optimization instruction for optimizing the Android installation package APK;

[0075] In this step, the optimization instruction may be an optimization instruction for optimizing the Android installation package in the Android system input by an operator during the Android application development stage, or an optimization instruction for optimizing the Android installation package triggered by a user when installing an Android application, or an optimization instruction for optimizing the Android installation package set in advance. That is, when the optimization instruction is triggered, the mobile terminal or server may detect the optimization instruction for optimizing the Android installation package APK. The optimization instruction may be a string of characters or a piece of code, etc.

[0076] Next, executing step 102, decompiling the APK according to the optimization instruction to obtain all images in the APK;

[0077] Since the mobile terminal App installation packages are all APK files, after the Android application is developed, the application will be packaged into an APK file for users to install. At this time, it is difficult to see the resource files and codes used in the development of the application. In other words, after the Android application is packaged into an APK, if you still want to see the resource files and codes of the application, you can only do it through decompilation. That is, through some tools (such as Apktool, etc.), you can decompile the APK. After decompilation, you can get the resource files (pictures) used to develop the application. Of course, you can also get layout, style and related implementation code, etc.

[0078] It should be noted that, in this embodiment, the APK is a zip package. If the APK is decompressed using a decompression tool, the APK structure can be obtained, and the following files included in the APK structure can be displayed to the user:

[0079] AndroidManifest.xml: global configuration file of the application;

[0080] assets folder: original resource folder, corresponding to the assets folder of the Android project, generally used to store original web pages, audio, etc.;

[0081] classes.dex: After the source code is compiled into class, it is converted into jar and then compressed into dex file. Dex is a file that can be run directly on the Android virtual machine.

[0082] lib folder: so files of referenced third-party SDKs.

[0083] META-INF folder: Apk signature file.

[0084] res folder: resource files, including layout, pictures, etc.

[0085] resources.arsc: records the mapping relationship between resource files and resource IDs.

[0086] However, users cannot directly read these displayed files because they have been processed by the build-tools packaging tool. Therefore, these files must be decompiled, that is, the APK is split into readable files. The purpose of decompilation is usually to obtain the AndroidManifest.xml file, res file, and java code in the APK.

[0087] The specific implementation process of decompilation is already well known to those skilled in the art and will not be described in detail here.

[0088] Again, executing step 103, traversing all pictures, and detecting similar pictures among all pictures;

[0089] In this step, the traversal method may be: the mobile terminal or the server determines whether the similarity between all pictures meets a preset threshold, and if so, determines that the pictures meeting the preset threshold are similar pictures.

[0090] In this step, the similarity between the pictures can be determined by judging whether the similarity between the pictures meets a preset threshold by judging the content, size, color or outline of the pictures.

[0091] Finally, step 104 is executed to delete redundant pictures from the similar pictures.

[0092] In this embodiment, there are multiple ways to delete redundant pictures from similar pictures:

[0093] One method is blind deletion: that is, after similar pictures are found in step 103, any one of the similar pictures is retained and the other remaining pictures in the similar pictures are deleted. For example, if 10 pictures are found to be similar pictures, the mobile terminal or server can automatically retain any one of the 10 similar pictures and delete the remaining 9 similar pictures.

[0094] Another method is to delete with purpose: the mobile terminal or the server automatically compares the size of each of the similar pictures; then, deletes the pictures with larger volumes among the similar pictures.

[0095] Among them, the mobile terminal or server can determine the size of the similar pictures by comparing the format of each picture in the similar pictures. Of course, the size of the picture can also be known through the attributes of each similar picture. There are many ways to determine the size of each picture, which will not be described one by one in this embodiment.

[0096] The method for optimizing the size of the installation package shown in this exemplary embodiment detects an optimization instruction for optimizing the Android installation package APK; decompiles the APK according to the optimization instruction to obtain all the images in the APK; traverses all the images to obtain similar images among all the images; and deletes redundant images among the similar images. That is to say, in the present disclosure, when an optimization instruction for optimizing the Android installation package APK is detected, all the images in the APK are obtained by decompiling the APK, and then traversing all the images, similar images are detected, and redundant images among the similar images are deleted. That is, by deleting similar images in the Android installation package, the size of the Android installation package is optimized, thereby reducing the download pressure of the application and improving the download efficiency of the application.

[0097] See also Figure 2 , Figure 2 is another flow chart of a method for optimizing the volume of an installation package according to an exemplary embodiment, and the method may further include:

[0098] Step 201: Detecting an optimization instruction for optimizing an Android installation package APK;

[0099] Step 202: Decompile the APK according to the optimization instruction to obtain all images in the APK;

[0100] Step 203: traverse all pictures and detect similar pictures among all pictures;

[0101] In this embodiment, steps 201 to 203 are the same as steps 101 to 103. The specific implementation process is detailed above and will not be repeated here.

[0102] Step 204: displaying the similar pictures to an operator;

[0103] In this step, after detecting similar images among all images, the mobile terminal or server first displays the similar images to operators (such as R&D personnel or maintenance personnel in the R&D stage), so that the operators can determine which similar images need to be deleted according to their needs.

[0104] Step 205: Detecting a deletion instruction input by the operator;

[0105] In this step, when the mobile terminal or the server detects a deletion instruction input by the operator to delete certain similar photos, step 206 is executed.

[0106] Step 206: According to the deletion instruction, delete the corresponding picture in the similar pictures.

[0107] In this step, the mobile terminal or the server deletes the corresponding picture in the similar pictures according to the detected deletion instruction.

[0108] In the disclosed embodiment, the mobile terminal or server automatically displays similar images among all the retrieved images to the operator, so that the operator can judge which similar images need to be deleted according to the needs, saving the operator's time in manually searching for similar images and improving the retrieval efficiency. When the deletion instruction input by the operator is detected, the corresponding image in the similar images is deleted, thereby achieving the purpose of optimizing or cutting the size of the Android installation package. Not only does it reduce the download pressure of the application, but it also improves the download efficiency of the application.

[0109] Optionally, in another embodiment, based on the above embodiment, the traversal of all pictures and detection of similar pictures among all pictures includes: determining whether the similarity between all pictures meets a preset threshold, and if so, determining that the pictures meeting the preset threshold are similar pictures.

[0110] The step of determining whether the similarity between all images meets a preset threshold includes:

[0111] Use N preset image similarity algorithms to determine whether the similarities between all images meet the corresponding preset thresholds; where N is a natural number greater than or equal to 2, that is, N≥2.

[0112] Optionally, in another embodiment, based on the above embodiment, before using N kinds of picture similarity algorithms to determine whether the similarities between all pictures meet corresponding preset thresholds, the method may further include:

[0113] The preset N kinds of picture similarity algorithms are sorted to obtain N! (i.e., the factorial of N) kinds of sorting sequences.

[0114] For example, if N is 2, then by sorting the two image similarity algorithms, we get 2! = 2*1 sorting sequences, that is, two sorting sequences;

[0115] Similarly, if N is 4, then by sorting these 4 image similarity algorithms, we get 4! = 4*3*2*1 sorting sequences, that is, 24 sorting sequences.

[0116] Specifically, the method of using the preset N picture similarity algorithms to determine whether the similarities between all pictures meet the corresponding preset thresholds specifically includes:

[0117] Select any one sorting sequence from the N! sorting sequences;

[0118] The first picture similarity algorithm of the selected sorting sequence is used to determine whether the similarity between all pictures meets the corresponding preset threshold, and the subsequent picture similarity algorithms in the sorting method are used in turn to iteratively determine the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, until the last picture similarity algorithm of the sorting method is used to determine the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, so as to obtain the final similar pictures.

[0119] That is, firstly, a first picture similarity algorithm of a selected sorting sequence is used to determine whether the similarity between all pictures meets a first preset threshold; if so, the picture meeting the first preset threshold is determined to be a first similar picture;

[0120] Continue to use the second picture similarity algorithm of the sorting sequence to determine whether the similarity between the first similar pictures meets a second preset threshold; if so, determine that the picture meeting the second preset threshold is a second similar picture;

[0121] Then, a subsequent picture similarity algorithm in the sorting sequence is used in turn to iteratively judge the intermediate similar pictures that meet the corresponding preset threshold value obtained by judging by the previous picture similarity algorithm;

[0122] Until the end, the last (for example, the Nth) picture similarity algorithm in the sorting sequence is used to continue to determine whether the N-1th similar pictures meet the corresponding Nth preset threshold; if they do, the picture that meets the Nth preset threshold is determined to be the Nth similar picture; the Nth similar picture is the similar picture finally obtained. In this embodiment, the first preset threshold, the second preset threshold, and the Nth preset threshold can be the same value or different values, which is not limited in this embodiment.

[0123] In this embodiment, N preset picture similarity algorithms (i.e., multiple picture similarity algorithms) can be used to determine whether the similarity between all pictures meets a preset threshold. If so, the pictures that meet the preset threshold are determined to be similar pictures, where N≥2. It should be noted that, although a single picture similarity algorithm (i.e., N=1) can also realize the search for similar pictures, the accuracy of similar search is too low and is generally not considered. The present disclosure uses multiple picture similarity algorithms to comprehensively determine similar pictures, thereby improving the accuracy of similar picture search.

[0124] The preset N image similarity algorithms include at least two of the following: an image normalization processing algorithm, an image Euclidean distance judgment algorithm, an image contour judgment algorithm, and an image main color judgment algorithm. The above-mentioned image similarity algorithms are all based on opencv image similarity algorithms, which are well-known technologies in the art and will not be described in detail here.

[0125] In this embodiment, the first preset threshold, the second preset threshold, ..., the Nth preset threshold may be the same or different, and this embodiment does not limit this. For example, the first preset threshold, the second preset threshold, ..., the Nth preset threshold may be set to 90% or 95% or 98%, etc. Of course, they may also be set to different values, for example, the first preset threshold is 85%, the second preset threshold is 87%, ..., the Nth preset threshold is 94%, of course, the first preset threshold may also be set to 95%, the second preset threshold is 90%, ..., the Nth preset threshold is 85%, etc.

[0126] It should be noted that, in this embodiment, when N≥2, N preset image similarity algorithms are used. In practical applications, the N image similarity algorithms can be executed according to any preset sorting sequence.

[0127] Optionally, in another embodiment, based on the above embodiment, before using N kinds of picture similarity algorithms to determine whether the similarities between all pictures meet the corresponding preset thresholds, the method may further include: sorting the preset N kinds of picture similarity algorithms to obtain N! (i.e., the factorial of N) kinds of sorting sequences.

[0128] For example, when N=4, the four image similarity algorithms are respectively taken as an image normalization processing algorithm, an image Euclidean distance judgment algorithm, an image contour judgment algorithm, and an image main color judgment algorithm. In actual applications, the order of the preset four image similarity algorithms can be any of the following (only four ordering sequences are listed here). There are 24 ordering sequences in actual applications:

[0129] Image normalization processing algorithm > Image Euclidean distance judgment algorithm > Image contour judgment algorithm > Image main color judgment algorithm; or

[0130] Image Euclidean distance judgment algorithm > Image contour judgment algorithm > Image main color judgment algorithm > Image normalization processing algorithm; or

[0131] Image contour judgment algorithm > Image main color judgment algorithm > Image normalization processing algorithm > Image Euclidean distance judgment algorithm; or

[0132] Image main color judgment algorithm > Image normalization processing algorithm > Image Euclidean distance judgment algorithm > Image contour judgment algorithm.

[0133] Of course, in practical applications, the above-mentioned picture similarity algorithms are not limited thereto, and this embodiment is just used as an example for illustration.

[0134] For example, if we use the sorting sequence: image normalization algorithm > image Euclidean distance judgment algorithm > image contour judgment algorithm > image main color judgment algorithm to judge, the specific judgment process is:

[0135] First, a picture normalization processing algorithm is used to determine whether the similarity between all pictures meets a first preset threshold; if so, the picture meeting the first preset threshold is determined to be a first similar picture;

[0136] Secondly, the Euclidean distance judgment algorithm is used to continue to judge whether the similarity between the first similar pictures meets the second preset threshold; if so, the similar picture that meets the second preset threshold is determined as the second similar picture;

[0137] Then, the image contour judgment algorithm is used to continue to judge whether the similarity between the second similar images meets a third preset threshold; if so, the similar images that meet the third preset threshold are determined to be third similar images;

[0138] Finally, the image main color judgment algorithm is used to continue to determine whether the similarity between the third similar images meets the fourth preset threshold; if so, the similar image that meets the fourth preset threshold is determined to be the fourth similar image; and the fourth similar image is used as the final similar image.

[0139] It should be noted that the first preset threshold, the second preset threshold, the third preset threshold and the fourth preset threshold can be set to the same value or different values ​​as needed, and this embodiment does not limit this.

[0140] The process of judging similar images using the sorting methods of several other image similarity algorithms is similar to the above process. Please refer to the above for details and will not be repeated here.

[0141] In addition, for those skilled in the art, it is a well-known technology to use any image similarity judgment method (such as image normalization processing algorithm, image Euclidean distance judgment algorithm, image contour judgment algorithm, image main color judgment algorithm, etc.) to judge whether each two images are similar, or whether the similarity meets a preset threshold, which will not be repeated here.

[0142] In the present disclosure, all images in the APK are obtained by decompiling the APK, and then the similar images among all the images are determined by using the algorithm of multiple image similarity, and redundant images among the similar images are deleted. This not only improves the accuracy of finding similar images, but also achieves the purpose of cutting the size of the Android installation package by deleting redundant images in the similar images in the Android installation package.

[0143] It should be noted that, for the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that this implementation disclosure is not limited by the order of the actions described, because according to this disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by this disclosure.

[0144] Figure 3 is a block diagram of a device for optimizing the size of an installation package according to an exemplary embodiment. Figure 3 The device includes: a first detection module 301, a decompilation module 302, a traversal module 303 and a first deletion module 304.

[0145] The first detection module 301 is configured to execute an optimization instruction for detecting and optimizing an Android installation package APK;

[0146] The decompile module 302 is configured to execute decompile of the APK according to the optimization instruction;

[0147] The traversal module 303 is configured to traverse all pictures and detect similar pictures among all pictures;

[0148] The first deletion module 304 is configured to delete redundant pictures in the similar pictures.

[0149] Optionally, in another embodiment, based on the above embodiment, the traversal module 303 includes: a judgment module 401 and a determination module 402, and its structural diagram is as shown in FIG. Figure 4 As shown,

[0150] The determination module 401 is configured to determine whether the similarity between all pictures meets a preset threshold;

[0151] The determination module 402 is configured to determine that pictures that meet the preset threshold are similar pictures when the determination module 401 determines that the similarities between all pictures meet the preset threshold.

[0152] Optionally, in another embodiment, based on the above embodiment, the judgment module 401 is specifically configured to execute N kinds of image similarity algorithms to determine whether the similarities between all images meet the corresponding preset thresholds; wherein N is a natural number greater than or equal to 2.

[0153] Optionally, in another embodiment, based on the above embodiment, the device further includes: a sorting module 501, whose structural diagram is as shown in FIG. Figure 5 As shown,

[0154] The sorting module 501 is configured to sort the preset N picture similarity algorithms to obtain N! sorting sequences before the judging module 401 uses the N picture similarity algorithms to judge whether the similarities between all pictures meet the corresponding preset thresholds.

[0155] Optionally, in another embodiment, based on the above embodiment, the judgment module 401 includes: a selection module and an iterative judgment module (not shown in the figure), wherein:

[0156] A selection module is configured to select any one of the N! sorting sequences obtained by sorting the sorting module;

[0157] The iterative judgment module is configured to execute the first picture similarity algorithm of the sorting sequence selected by the selection module to judge whether the similarity between all pictures meets the corresponding preset threshold; sequentially use the subsequent picture similarity algorithm in the sorting sequence to iteratively judge the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, until the last picture similarity algorithm of the sorting sequence is used to judge the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, so as to obtain the final similar pictures.

[0158] Optionally, in another embodiment, based on the above embodiment, the judgment module uses N kinds of picture similarity algorithms including at least the following two:

[0159] Image normalization processing algorithm, image Euclidean distance judgment algorithm, image contour judgment algorithm and image main color judgment algorithm.

[0160] Optionally, in another embodiment, based on the above embodiment, the first deletion module 404 includes: a comparison module 601 and a picture deletion module 602, and its structural diagram is as shown in FIG. Figure 6 As shown,

[0161] The comparison module 601 is configured to compare the volume of each image in the similar images;

[0162] The picture deleting module 502 is configured to delete the pictures with large volumes among the similar pictures.

[0163] Optionally, in another embodiment, based on the above embodiment, the device may further include: a display module 701, a second detection module 702 and a second deletion module 703, and its structural diagram is shown as follows: Figure 7 As shown,

[0164] The display module 701 is configured to display the similar pictures to the user after the traversal module 303 detects similar pictures among all pictures;

[0165] The second detection module 702 is configured to execute the deletion instruction input by the user;

[0166] The second deleting module 703 is configured to execute the deleting instruction to delete the corresponding picture in the similar pictures.

[0167] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method. For relevant details, please refer to the partial description of the method embodiment, and will not be elaborated here.

[0168] An electronic device shown in an embodiment of the present disclosure includes:

[0169] processor;

[0170] a memory for storing instructions executable by the processor;

[0171] The processor is configured to execute the instructions to achieve the optimization of the installation package volume as described above.

[0172] The present disclosure also provides a storage medium. When the instructions in the storage medium are executed by a processor of an installation package volume optimization device or an electronic device, the installation package volume optimization device or the electronic device can perform any of the installation package volume optimizations described above.

[0173] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method. For relevant details, please refer to the partial description of the method embodiment, and will not be elaborated here.

[0174] Alternatively, the computer-readable storage medium may be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0175] The present disclosure also provides a computer program product. When the instructions in the computer program product are executed by a processor of an installation package volume optimization device or an electronic device, the installation package volume optimization device or the electronic device executes the installation package volume optimization method as described above.

[0176] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0177] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for optimizing the volume of an installation package, characterized in that: include: Detected optimization instructions for optimizing the Android installation package APK; The optimization instruction is triggered by the user when installing the Android application; Decompile the APK according to the optimization instruction to obtain all images in the APK; Traverse all pictures and detect similar pictures among all pictures; Deleting redundant pictures from the similar pictures; The traversing of all pictures and detecting similar pictures among all pictures include: Determine whether the similarity between all pictures meets a preset threshold, and if so, determine that the pictures meeting the preset threshold are similar pictures; The step of judging whether the similarity between all the pictures meets a preset threshold comprises: Using N preset image similarity algorithms to determine whether the similarities between all images meet corresponding preset thresholds; where N is a natural number greater than or equal to 2; Before using N kinds of picture similarity algorithms to determine whether the similarities between all pictures meet corresponding preset thresholds, the method further includes: Sorting the preset N kinds of image similarity algorithms to obtain N! kinds of sorting sequences; The method of using the preset N kinds of picture similarity algorithms to determine whether the similarities between all pictures meet the corresponding preset thresholds specifically includes: Select any one sorting sequence from the N! sorting sequences; The first picture similarity algorithm selected in the sorting sequence is used to determine whether the similarity between all pictures meets the corresponding preset threshold, and the subsequent picture similarity algorithms in the sorting sequence are used in turn to iteratively determine the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, until the last picture similarity algorithm in the sorting sequence is used to determine the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, so as to obtain the final similar pictures.

2. The optimization method according to claim 1, characterized in that: The preset N kinds of image similarity algorithms include at least the following two: an image normalization processing algorithm, an image Euclidean distance judgment algorithm, an image contour judgment algorithm and an image main color judgment algorithm.

3. The optimization method according to any one of claims 1 to 2, characterized in that: The deleting redundant pictures from the similar pictures comprises: Comparing the volume of each of the similar pictures; Delete the large pictures among the similar pictures.

4. The optimization method according to any one of claims 1 to 2, characterized in that: After determining similar pictures among all pictures, the method further includes: showing the similar pictures to an operator; detecting a deletion instruction input by the operator; According to the deletion instruction, the corresponding picture in the similar pictures is deleted.

5. A device for optimizing the volume of an installation package, characterized in that: include: The first detection module is configured to execute an optimization instruction for detecting and optimizing an Android installation package APK; The optimization instruction is triggered by the user when installing the Android application; A decompilation module is configured to execute decompilation of the APK according to the optimization instruction to obtain all images in the APK; The traversal module is configured to perform a traversal of all images and detect similar images among all images; A first deleting module is configured to delete redundant pictures from the similar pictures; The traversal module includes: A determination module is configured to determine whether the similarity between all images meets a preset threshold; A determination module, configured to determine that pictures that meet the preset threshold are similar pictures when the determination module determines that the similarity between all pictures meets the preset threshold; The determination module is specifically configured to use N preset picture similarity algorithms to determine whether the similarities between all pictures meet corresponding preset thresholds; wherein N is a natural number greater than or equal to 2; The device also includes: The sorting module is configured to sort the preset N kinds of picture similarity algorithms to obtain N! sorting sequences before the judging module uses the N kinds of picture similarity algorithms to judge whether the similarities between all pictures meet the corresponding preset thresholds; The judging module comprises: A selection module is configured to select any one of the N! sorting sequences obtained by sorting the sorting module; The iterative judgment module is configured to execute the first picture similarity algorithm of the sorting sequence selected by the selection module to judge whether the similarity between all pictures meets the corresponding preset threshold; sequentially use the subsequent picture similarity algorithm in the sorting sequence to iteratively judge the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, until the last picture similarity algorithm of the sorting sequence is used to judge the intermediate similar pictures that meet the corresponding preset threshold by using the previous picture similarity algorithm, so as to obtain the final similar pictures.

6. The optimization device according to claim 5, characterized in that: The judgment module uses N kinds of picture similarity algorithms including at least the following two: Image normalization processing algorithm, image Euclidean distance judgment algorithm, image contour judgment algorithm and image main color judgment algorithm.

7. The optimization device according to any one of claims 5 to 6, characterized in that: The first deletion module comprises: A comparison module is configured to compare the volume of each image in the similar images; The picture deleting module is configured to delete the pictures with large volume among the similar pictures.

8. The optimization device according to any one of claims 5 to 6, characterized in that: The device also includes: A display module, configured to display the similar pictures to the user after the traversal module detects similar pictures among all pictures; A second detection module is configured to execute a deletion instruction detected to be input by the user; The second deleting module is configured to execute the deleting instruction to delete the corresponding picture in the similar pictures.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method for optimizing the volume of the installation package as described in any one of claims 1 to 4.

10. A storage medium, characterized in that: When the instructions in the storage medium are executed by the device for optimizing the volume of the installation package or the processor of the electronic device, the device for optimizing the volume of the installation package or the electronic device can execute the method for optimizing the volume of the installation package as described in any one of claims 1 to 4.