CN112947929B - Method, device, computer equipment and medium for constructing application program installation package - Google Patents

Method, device, computer equipment and medium for constructing application program installation package Download PDF

Info

Publication number
CN112947929B
CN112947929B CN202110118711.9A CN202110118711A CN112947929B CN 112947929 B CN112947929 B CN 112947929B CN 202110118711 A CN202110118711 A CN 202110118711A CN 112947929 B CN112947929 B CN 112947929B
Authority
CN
China
Prior art keywords
file
generating
decompiled
reserved
decompilation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110118711.9A
Other languages
Chinese (zh)
Other versions
CN112947929A (en
Inventor
答奇
孙克静
魏君成
薛章斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202110118711.9A priority Critical patent/CN112947929B/en
Publication of CN112947929A publication Critical patent/CN112947929A/en
Application granted granted Critical
Publication of CN112947929B publication Critical patent/CN112947929B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure provides a method, an apparatus, a computer device, and a medium for constructing an application installation package, where the method includes: generating a reserved file containing pile occupying codes with preset space size, and generating a corresponding main dex file based on the reserved file; decompiling the main dex file to obtain a corresponding first decompiled file; replacing a decompilation sub file corresponding to the reserved file in the first decompilation file with a pre-generated preset file without any method to obtain a second decompilation file; and generating an application program installation package (APK) based on the second decompiled file. The method and the device can safely and effectively reserve enough space in the main dex file when the D8 tool is utilized to construct the APK.

Description

Method, device, computer equipment and medium for constructing application program installation package
Technical Field
The disclosure relates to the field of computer technology, and in particular relates to a method, a device, computer equipment and a medium for constructing an application program installation package.
Background
At present, an application package (Android application package, APK) is mainly built by using a D8 tool, but when the APK is built by using the D8 tool, the number of methods for forming a main dex (file extension) file of the APK is close to the upper limit under the condition that the number of methods is large, and no redundant space is reserved for storing external byte codes.
Disclosure of Invention
In view of this, the embodiments of the present disclosure at least provide a method, an apparatus, a computer device, and a medium for constructing an application installation package, where a part of space is reserved in a main dex file by a compiling tool during the process of constructing an APK file.
In a first aspect, an embodiment of the present disclosure provides a method for constructing an application installation package, including: generating a reserved file containing pile occupying codes with preset space size, and generating a corresponding main dex file based on the reserved file; decompiling the main dex file to obtain a corresponding first decompiled file; replacing a decompilation sub file corresponding to the reserved file in the first decompilation file with a pre-generated preset file which does not contain any method to obtain a second decompilation file; and generating an application program installation package (APK) based on the second decompiled file.
In one possible implementation manner, the generating the reserved file containing the stub code with the preset space size includes: acquiring the preset space size; generating a Java class file containing the stub code of the preset space size through a script based on the preset space size; generating a class file containing the stub code of the preset space size based on the Java class file; and determining the class file as the reserved file.
In one possible implementation manner, the generating the application installation package APK based on the second decompiled file includes: a compiling tool is called to compile the second decompiled file to generate a target main dex file; and generating the APK based on the target main dex file.
In one possible implementation, the preset file is generated according to the following procedure: generating a Java class file without any method through a script, wherein the Java class file without any method does not contain any method; generating a class file which does not contain any method based on the Java class file which does not contain any method; and converting the class file which does not contain any method into the preset file which is the same as the decompilation sub file in type based on the decompilation sub file in type.
In a possible implementation manner, the generating a corresponding main dex file based on the reserved file includes: calling a construction tool to generate a corresponding main dex file based on the reserved file, wherein the compiling tool comprises a D8 tool; the decompiling the main dex file to obtain a corresponding first decompiled file includes: and calling a compiling tool to decompil the main dex file to obtain a corresponding first decompiled file, wherein the compiling tool comprises a basksmalli tool, and the type of the decompiled sub-file comprises a smali file.
In one possible implementation, the stub code includes a null method.
In a second aspect, an embodiment of the present disclosure further provides an apparatus for constructing an application installation package, including: the first generation module is used for generating a reserved file containing stub codes with preset space size and generating a corresponding main dex file based on the reserved file; the decompilation module is used for decompiling the main dex file to obtain a corresponding first decompiled file; the replacing module is used for replacing the decompilation subfile corresponding to the reserved file in the first decompilation file with a pre-generated preset file which does not contain any method to obtain a second decompilation file; and the second generating module is used for generating an application program installation package APK based on the second decompiled file.
In one possible implementation manner, when a reserved file containing stub codes of a preset space size is generated, the first generating module is specifically configured to obtain the preset space size; generating a Java class file containing the stub code of the preset space size through a script based on the preset space size; generating a class file containing the stub code of the preset space size based on the Java class file; and determining the class file as the reserved file.
In a possible implementation manner, when generating the application program installation package APK based on the second decompilation file, the second generating module is specifically configured to invoke a compiling tool to compile the second decompilation file to generate a target master dex file; and generating the APK based on the target main dex file.
In a possible implementation manner, the first generating module is further configured to generate the preset file according to the following method: generating a Java class file without any method through a script, wherein the Java class file without any method does not contain any method; generating a class file which does not contain any method based on the Java class file which does not contain any method; and converting the class file which does not contain any method into the preset file which is the same as the decompilation sub file in type based on the decompilation sub file in type.
In a possible implementation manner, when generating the corresponding main dex file based on the reserved file, the first generating module is specifically configured to call a building tool to generate the corresponding main dex file based on the reserved file, and the compiling tool includes a D8 tool;
when decompiling is performed on the main dex file to obtain a corresponding first decompiled file, the decompiled module is specifically configured to call a compiling tool to decompil the main dex file to obtain a corresponding first decompiled file, where the compiling tool includes a basksmalli tool, and the type of the decompiled sub-file includes a smali file.
In one possible implementation, the stub code includes a null method.
In a third aspect, embodiments of the present disclosure further provide a computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect, or any of the possible implementations of the first aspect.
In a fourth aspect, the presently disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the first aspect, or any of the possible implementations of the first aspect.
The description of the effects of the apparatus, the computer device, and the computer-readable storage medium for constructing the application installation package refers to the description of the method for constructing the application installation package, and is not repeated here.
According to the method, the device and the computer equipment for constructing the application program installation package, pile occupying codes containing the preset space size can be generated in the reserved files forming the main dex file in the process of constructing the APK through the D8 tool, then the main dex file is decompiled to obtain a first decompiled file, the decompiled sub files corresponding to the reserved files in the first decompiled file are replaced by the preset files which do not contain any method to obtain a second decompiled file, the APK is constructed after the replaced second decompiled file is recompiled to a new main dex file, and therefore the reserved space containing the preset space size is contained in the main dex file for constructing the APK, and when the APK file is constructed through the D8 tool, the reserved space is reserved in the main dex file.
The foregoing objects, features and advantages of the disclosure will be more readily apparent from the following detailed description of the preferred embodiments taken in conjunction with the accompanying drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for the embodiments are briefly described below, which are incorporated in and constitute a part of the specification, these drawings showing embodiments consistent with the present disclosure and together with the description serve to illustrate the technical solutions of the present disclosure. It is to be understood that the following drawings illustrate only certain embodiments of the present disclosure and are therefore not to be considered limiting of its scope, for the person of ordinary skill in the art may admit to other equally relevant drawings without inventive effort.
FIG. 1 illustrates a flow chart of a method of building an application installation package provided by an embodiment of the present disclosure;
FIG. 2 illustrates a flow chart of generating a reservation file containing stub codes of a preset space size provided by an embodiment of the present disclosure;
FIG. 3 illustrates a flowchart of a method of generating a preset file provided by an embodiment of the present disclosure;
FIG. 4 illustrates a flowchart of a method for generating an APK based on a second decompiled file provided by embodiments of the present disclosure;
FIG. 5 illustrates a schematic diagram of an apparatus for building an application installation package provided by an embodiment of the present disclosure;
fig. 6 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. The components of the embodiments of the present disclosure, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be made by those skilled in the art based on the embodiments of this disclosure without making any inventive effort, are intended to be within the scope of this disclosure.
Furthermore, the terms first, second and the like in the description and in the claims of embodiments of the disclosure and in the above-described figures, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein.
Reference herein to "a plurality of" or "a number" means two or more than two. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
According to research, the APK comprises a main dex file and a non-main dex file, the number of methods in each dex file cannot exceed 64 kilobytes (Kilobyte, KB), otherwise, generation failure of the dex file occurs, when the D8 tool is used for constructing the APK, under the condition that the number of methods is large, the D8 tool can write the methods into the main dex file preferentially, a developer cannot judge which methods are necessarily placed in the main dex file, the methods in the main dex file cannot be moved into the non-main dex file in a trade manner, the number of the methods in the main dex file can reach the upper limit of 64KB, and no redundant space is reserved for storing external byte codes.
Based on the above-mentioned research, the disclosure provides a method, an apparatus, a computer device and a medium for constructing an application installation package, which can generate stub codes containing a preset space size in a reserved file forming a main dex file in the process of constructing an APK through a D8 tool, decompil the main dex file to obtain a first decompiled file, because the stub codes do not have to be stored in the main dex file, the replacement does not affect the finally generated APK, the reserved file in the first decompiled file can be replaced with the preset file not containing any method to correspond to the decompiled sub-file, and the APK is constructed after the new main dex file is recompiled based on the replaced second decompiled file, so that the reserved space of the preset space size is contained in the main dex file forming the APK, and when the APK file is constructed by using the D8 tool, the reserved space in the main dex file is realized.
The present invention is directed to a method for manufacturing a semiconductor device, and a semiconductor device manufactured by the method.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
For the sake of understanding the present embodiment, first, a detailed description will be given of a method for constructing an application installation package disclosed in the present embodiment, where an execution body of the method for constructing an application installation package provided in the present embodiment is generally a computer device with a certain computing capability, where the computer device includes, for example: the terminal device, or server or other processing device, may be a User Equipment (UE), mobile device, user terminal, cellular telephone, cordless telephone, personal digital assistant (Personal Digital Assistant, PDA), handheld device, computing device, vehicle mounted device, wearable device, etc. In some possible implementations, the method of constructing the application installation package may be implemented by a processor invoking computer readable instructions stored in a memory.
The following describes a method for constructing an application installation package according to an embodiment of the present disclosure, taking an execution body as a computer device as an example.
Example 1
Referring to fig. 1, a flowchart of a method for constructing an application installation package according to an embodiment of the disclosure is shown, where the method includes the following steps:
s101: and generating a reserved file containing the stub code with the preset space size, and generating a corresponding main dex file based on the reserved file.
The stub code is a code that is not used in the implementation process, and may be, for example, a null method.
The most basic unit of capacity used in a computer to represent the size of a storage space is bytes (bytes), which are the unit in which information is transferred over a network (or stored in a hard disk or memory). The smallest unit of data in a computer is a bit (binary bit), and every 8 bits constitute one Byte (Byte), but the most basic unit representing the storage capacity is Byte.
1 kb=1024B (bytes); 1 mb=1024 kb=1048576B (bytes); 1 gb=1024 mb= 1073741824B (bytes). Where K in KB represents "kilo", 1024KB, i.e., 100 ten thousand, so M in MB represents "million", i.e., million,1024MB, i.e., gigabyte, in GB.
In specific implementation, according to the preset space size, a reserved file containing stub codes of the preset space size may be generated according to the flow shown in fig. 2:
s201: and acquiring the preset space size, and generating a Java class file containing stub codes of the preset space size through a script based on the preset space size.
The preset space size may be determined based on actual situations. For example, the preset space size is 30KB, a Java class file containing 30KB stub code, namely a Java class file containing 30KB stub code DexStub.Java class file is generated through script, as shown below,
public class DexStub{
public void foo1(){}
public void foo2(){}
……………………
public void foo30000(){}
}
s202: and generating a class file containing stub codes with a preset space size based on the Java class file.
The DexStub.class file is generated from the DexStub.Java class file containing the 30KB stub code generated in step S201.
S203: and determining the class file as a reserved file.
The DexStub.class file is a reserved file containing the stub code with the preset space size, and when the preset space size is 30KB, the DexStub.class file contains the stub code with the preset space size of 30 KB.
In specific implementation, a construction tool is called based on the reserved file to generate a corresponding main dex file. The build tool may be, for example, a D8 tool, without limitation.
In the process of constructing an APK by using a multi-dex tool, the main dex file is the main dex file, and after a reserved file, namely a dexstub. Class file is generated, a call is added in a custom Application subclass in the android project in the following form,
public class CustomApplication extends Application{
@Override
public void attachBaseContext(Context base){
super.attach BaseContext(base);
android.util.Log.d(“whatever”,””,+DexStub.Class);
Multidex.install(this);
}
}
leading to the DexStub. Class before the Multidex# install method in the attchBaseContext method, the Multidex tool arranges the class in the main dex file when building APK.
The above-mentioned step S101 is carried out,
s102: decompilation is carried out on the main dex file to obtain a corresponding first decompilation file.
In specific implementation, a compiling tool is called to decompil the main dex file to obtain a corresponding first decompiled file. The compiling tool may be various, for example, a basksmalli tool, and is not limited herein.
Illustratively, the basksmalli tool is used for decompiling the main dex file, namely the main dex file, so as to obtain a decompiled file, wherein the decompiled file comprises a DexStub.Smali file, namely a decompiled sub-file, corresponding to a DexStub.class file, namely a reserved file, and the DexStub.Smali file comprises 30KB stub code.
S103: and replacing the decompilation subfile corresponding to the reserved file in the first decompilation file with a pre-generated preset file without any method to obtain a second decompilation file.
In specific implementation, the first decompilation file includes a decompilation sub file corresponding to the reserved file, where a type of the pre-generated pre-set file is the same as a type of the decompilation sub file.
For example, if the type of the decompilation subfile corresponding to the reserved file is a Smali file, the preset file is a Smali file that does not include any method.
As shown in fig. 3, a flowchart of a method for generating a preset file according to an embodiment of the present disclosure includes:
s301: java class files that do not contain any methods are generated by script.
For example, a Java class file without any method, i.e., an empty DexStub class file, is generated, as shown below,
Public class DexStub{
}
s302: class files that do not contain any methods are generated based on Java class files that do not contain any methods.
A class file that does not contain any method, i.e., an empty DexStub.class file, is generated based on the empty DexStub class file generated in S301.
S303: based on the type of the decompilation subfile, the class file that does not contain any method is converted into a preset file of the same type as the type of the decompilation subfile.
In specific implementation, there are various tools for converting file types, and for illustration, taking the de-compiling sub-file type as a DexStub.Smali file as an example, a dx tool may be used to generate an empty DexStub.dx file according to an empty DexStub.class file, and then a basksmia tool may be used to convert the empty DexStub.dx file into an empty DexStub.Smali file.
And S103, replacing the decompilation sub file corresponding to the reserved file in the first decompilation file with a preset file which does not contain any method to obtain a new decompilation file, namely a second decompilation file.
For example, the DexStub.Smali file corresponding to the reserved file is replaced by the DexStub.Smali file which does not contain any method, and the replaced decompiled file is the second decompiled file.
S104: an application installation package APK is generated based on the second decompiled file.
In particular implementations, APK may be generated based on the second decompiled file according to, but not limited to, the method shown in fig. 4:
s401: and calling a compiling tool to compile the second decompiled file to generate a target main dex file.
In particular implementations, the second decompiled file may be compiled into the target master dex file by, but is not limited to, invoking a basksmalli tool.
S402: and generating the APK based on the target main dex file.
And generating an APK (advanced personal key) based on the target main dex file, wherein the target main dex file comprises a reserved space of 30 KB.
According to the embodiment of the disclosure, the reserved file containing stub codes with the set space size is generated in the main dex file in the process of constructing the application program package, the compiling tool decompiles the main dex file to obtain the first decompiled file, decompiled sub-files corresponding to the reserved file are obtained in the first decompiled file, and the decompiled sub-files are replaced with the same type of preset file which does not contain any method.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiment of the disclosure further provides a device for constructing an application installation package corresponding to the method for constructing an application installation package, and since the principle of solving the problem by the device in the embodiment of the disclosure is similar to that of the method for constructing the application installation package in the embodiment of the disclosure, the implementation of the device can refer to the implementation of the method, and the repetition is omitted.
Example two
Referring to fig. 5, a schematic diagram of an apparatus for constructing an application installation package according to a second embodiment of the disclosure is shown, where the apparatus includes: a first generation module 501, a decompilation module 502, a replacement module 503, and a second generation module 504; wherein,
a first generating module 501, configured to generate a reserved file containing stub codes with a preset space size, and generate a corresponding master dex file based on the reserved file;
a decompilation module 502, configured to decompil the master dex file to obtain a corresponding first decompiled file;
a replacing module 503, configured to replace a decompilation sub file corresponding to the reserved file in the first decompilation file with a pre-generated preset file without any method, so as to obtain a second decompilation file;
a second generating module 504, configured to generate an application installation package APK based on the second decompiled file.
In one possible implementation manner, when a reserved file containing stub codes of a preset space size is generated, the first generating module is specifically configured to obtain the preset space size; generating a Java class file containing the stub code of the preset space size through a script based on the preset space size; generating a class file containing the stub code of the preset space size based on the Java class file; and determining the class file as the reserved file.
In a possible implementation manner, when generating the application program installation package APK based on the second decompilation file, the second generating module is specifically configured to invoke a compiling tool to compile the second decompilation file to generate a target master dex file; and generating the APK based on the target main dex file.
In a possible implementation manner, the first generating module is further configured to generate the preset file according to the following method: generating a Java class file without any method through a script, wherein the Java class file without any method does not contain any method; generating a class file which does not contain any method based on the Java class file which does not contain any method; and converting the class file which does not contain any method into the preset file which is the same as the decompilation sub file in type based on the decompilation sub file in type.
In a possible implementation manner, when generating the corresponding main dex file based on the reserved file, the first generating module is specifically configured to call a building tool to generate the corresponding main dex file based on the reserved file, and the compiling tool includes a D8 tool;
when decompiling is performed on the main dex file to obtain a corresponding first decompiled file, the decompiled module is specifically configured to call a compiling tool to decompil the main dex file to obtain a corresponding first decompiled file, where the compiling tool includes a basksmalli tool, and the type of the decompiled sub-file includes a smali file.
In one possible implementation, the stub code includes a null method.
The process flow of each module in the apparatus and the interaction flow between the modules may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
Example III
The embodiment of the present disclosure further provides a computer device, as shown in fig. 6, which is a schematic structural diagram of a computer device provided in the third embodiment of the present disclosure, including:
a processor 61 and a memory 62; the memory 62 stores machine readable instructions executable by the processor 61, the processor 61 being configured to execute the machine readable instructions stored in the memory 62, the machine readable instructions when executed by the processor 61, the processor 61 performing the steps of: s101: generating a reserved file containing pile occupying codes with a preset space size, and generating a corresponding main dex file based on the reserved file; s102: decompiling the main dex file to obtain a corresponding first decompiled file; s103: replacing a decompilation sub file corresponding to a reserved file in the first decompilation file with a pre-generated preset file without any method to obtain a second decompilation file; s104: an application installation package APK is generated based on the second decompiled file.
The memory 62 includes a memory 621 and an external memory 622; the memory 621 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 61 and data exchanged with the external memory 622 such as a hard disk, and the processor 61 exchanges data with the external memory 622 via the memory 621.
The disclosed embodiments also provide a computer readable storage medium having a computer program stored thereon, which when executed by a processor performs the steps of the method for constructing an application installation package described in the above method embodiments. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The embodiments of the present disclosure further provide a computer program product, where the computer program product carries program code, and instructions included in the program code may be used to execute the steps of the method for constructing an application program installation package described in the foregoing method embodiments, and specifically reference may be made to the foregoing method embodiments, which are not described herein.
Wherein the above-mentioned computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present disclosure, and are not intended to limit the scope of the disclosure, but the present disclosure is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, it is not limited to the disclosure: any person skilled in the art, within the technical scope of the disclosure of the present disclosure, may modify or easily conceive changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features thereof; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the disclosure, and are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (14)

1. A method for constructing an application installation package, comprising:
generating a reserved file containing pile occupying codes with preset space size, and generating a corresponding main dex file based on the reserved file;
decompiling the main dex file to obtain a corresponding first decompiled file;
replacing a decompilation sub file corresponding to the reserved file in the first decompilation file with a pre-generated preset file which does not contain any method to obtain a second decompilation file;
and generating an application program installation package (APK) based on the second decompiled file.
2. The method of constructing as claimed in claim 1, wherein said generating a reservation file containing stub codes of a preset space size comprises:
acquiring the preset space size;
generating a Java class file containing the stub code of the preset space size through a script based on the preset space size; and
generating a class file containing the stub code of the preset space size based on the Java class file;
and determining the class file as the reserved file.
3. The method for constructing an application installation package APK according to claim 1, wherein generating an application installation package APK based on the second decompiled file includes:
a compiling tool is called to compile the second decompiled file to generate a target main dex file;
and generating the APK based on the target main dex file.
4. A construction method according to claim 1 or 3, characterized in that the pre-set file is generated according to the following procedure:
generating Java class files without any method through scripts; and
generating a class file which does not contain any method based on the Java class file which does not contain any method;
and converting the class file which does not contain any method into the preset file which is the same as the decompilation sub file in type based on the decompilation sub file in type.
5. A construction method according to claim 3, wherein said generating a corresponding master dex file based on said reserved file comprises:
calling a construction tool to generate a corresponding main dex file based on the reserved file, wherein the compiling tool comprises a D8 tool;
the decompiling the main dex file to obtain a corresponding first decompiled file includes:
and calling a compiling tool to decompil the main dex file to obtain a corresponding first decompiled file, wherein the compiling tool comprises a basksmalli tool, and the type of the decompiled sub-file comprises a smali file.
6. The building method of claim 1, wherein the stub code comprises a null method.
7. An apparatus for constructing an application installation package, comprising:
the first generation module is used for generating a reserved file containing stub codes with preset space size and generating a corresponding main dex file based on the reserved file;
the decompilation module is used for decompiling the main dex file to obtain a corresponding first decompiled file;
the replacing module is used for replacing the decompilation subfile corresponding to the reserved file in the first decompilation file with a pre-generated preset file which does not contain any method to obtain a second decompilation file;
and the second generating module is used for generating an application program installation package APK based on the second decompiled file.
8. The construction device according to claim 7, wherein the first generation module is configured to obtain a preset space size when generating a reserved file containing stub codes of the preset space size; generating a Java class file containing the stub code of the preset space size through a script based on the preset space size; generating a class file containing the stub code of the preset space size based on the Java class file; and determining the class file as the reserved file.
9. The construction device according to claim 7, wherein, when generating an application installation package APK based on the second decompiled file, the second generating module is specifically configured to invoke a compiling tool to compile the second decompiled file to generate a target master dex file; and generating the APK based on the target main dex file.
10. The building apparatus according to claim 7 or 9, wherein the first generating module is further configured to generate the preset file according to the following method: generating a Java class file without any method through a script, wherein the Java class file without any method does not contain any method; generating a class file which does not contain any method based on the Java class file which does not contain any method; and converting the class file which does not contain any method into the preset file which is the same as the decompilation sub file in type based on the decompilation sub file in type.
11. The building apparatus according to claim 9, wherein the first generation module is configured to, when generating a corresponding master dex file based on the reserved file, invoke a build tool to generate a corresponding master dex file based on the reserved file, the compile tool comprising a D8 tool;
when decompiling is performed on the main dex file to obtain a corresponding first decompiled file, the decompiled module is specifically configured to call a compiling tool to decompil the main dex file to obtain a corresponding first decompiled file, where the compiling tool includes a basksmalli tool, and the type of the decompiled sub-file includes a smali file.
12. The building apparatus of claim 7, wherein the stub code comprises a null method.
13. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the method of constructing an application installation package according to any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the method of constructing an application installation package according to any one of claims 1 to 6.
CN202110118711.9A 2021-01-28 2021-01-28 Method, device, computer equipment and medium for constructing application program installation package Active CN112947929B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110118711.9A CN112947929B (en) 2021-01-28 2021-01-28 Method, device, computer equipment and medium for constructing application program installation package

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110118711.9A CN112947929B (en) 2021-01-28 2021-01-28 Method, device, computer equipment and medium for constructing application program installation package

Publications (2)

Publication Number Publication Date
CN112947929A CN112947929A (en) 2021-06-11
CN112947929B true CN112947929B (en) 2023-11-24

Family

ID=76238691

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110118711.9A Active CN112947929B (en) 2021-01-28 2021-01-28 Method, device, computer equipment and medium for constructing application program installation package

Country Status (1)

Country Link
CN (1) CN112947929B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970659A (en) * 2014-05-16 2014-08-06 刘玉光 Android application software automation testing method based on pile pitching technology
CN107038103A (en) * 2017-04-14 2017-08-11 上海交通大学 Android program monitoring system and method based on bytecode pitching pile
CN107168749A (en) * 2017-05-31 2017-09-15 腾讯科技(深圳)有限公司 A kind of Compilation Method, device, equipment and computer-readable recording medium
CN107766096A (en) * 2016-08-19 2018-03-06 阿里巴巴集团控股有限公司 The generation method of application program installation kit, the operation method of application program and device
CN107832619A (en) * 2017-10-10 2018-03-23 电子科技大学 Vulnerability of application program automatic excavating system and method under Android platform
CN108427552A (en) * 2018-03-01 2018-08-21 深圳市创梦天地科技有限公司 Android application installation package producing device, method, electronic equipment and storage medium
WO2018192025A1 (en) * 2017-04-19 2018-10-25 北京洋浦伟业科技发展有限公司 Method for protecting executable program on android platform
CN110134400A (en) * 2019-04-02 2019-08-16 北京奇艺世纪科技有限公司 Data capture method, device, electronic equipment and computer readable storage medium
CN110297655A (en) * 2019-06-21 2019-10-01 百度在线网络技术(北京)有限公司 Generate method, apparatus, equipment and the storage medium of service packs

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970659A (en) * 2014-05-16 2014-08-06 刘玉光 Android application software automation testing method based on pile pitching technology
CN107766096A (en) * 2016-08-19 2018-03-06 阿里巴巴集团控股有限公司 The generation method of application program installation kit, the operation method of application program and device
CN107038103A (en) * 2017-04-14 2017-08-11 上海交通大学 Android program monitoring system and method based on bytecode pitching pile
WO2018192025A1 (en) * 2017-04-19 2018-10-25 北京洋浦伟业科技发展有限公司 Method for protecting executable program on android platform
CN107168749A (en) * 2017-05-31 2017-09-15 腾讯科技(深圳)有限公司 A kind of Compilation Method, device, equipment and computer-readable recording medium
CN107832619A (en) * 2017-10-10 2018-03-23 电子科技大学 Vulnerability of application program automatic excavating system and method under Android platform
CN108427552A (en) * 2018-03-01 2018-08-21 深圳市创梦天地科技有限公司 Android application installation package producing device, method, electronic equipment and storage medium
CN110134400A (en) * 2019-04-02 2019-08-16 北京奇艺世纪科技有限公司 Data capture method, device, electronic equipment and computer readable storage medium
CN110297655A (en) * 2019-06-21 2019-10-01 百度在线网络技术(北京)有限公司 Generate method, apparatus, equipment and the storage medium of service packs

Also Published As

Publication number Publication date
CN112947929A (en) 2021-06-11

Similar Documents

Publication Publication Date Title
CN108964982B (en) Method, apparatus and storage medium for enabling deployment of multiple nodes of a blockchain
CN102222012B (en) For the static type checking of external data source
US7543118B1 (en) Multiple variance platform for the management of mobile devices
CN108121594B (en) Process management method and device
EP2897074A1 (en) Application code obfuscation device based on self-conversion and method therefor
WO2018125296A1 (en) Improved hierarchic storage policy for distributed object storage systems
CN104899025A (en) Method and device for generating channel package
CN106648724B (en) Application program hot repair method and terminal
CN109614772B (en) Code conversion method and device based on application installation package file
CN104933368A (en) Network security vulnerability detection method and apparatus
CN110059456A (en) Code protection method, code protection device, storage medium and electronic equipment
KR20190030974A (en) Easy-to-use type of compile-time dependency injection method and device in the java platform
CN110659031A (en) Compiling method and device of application program, electronic equipment and storage medium
US12021845B2 (en) Method to anonymize client mac addresses for cloud reporting
CN112379940B (en) Executable file processing method and device, electronic equipment and storage medium
CN110333872B (en) Application processing method, device, equipment and medium
CN113986402A (en) Function calling method and device, electronic equipment and storage medium
CN105095784A (en) Terminal data writing and reading methods and devices
CN112947929B (en) Method, device, computer equipment and medium for constructing application program installation package
KR20170069337A (en) Method and apparatus for protecting application and program made by the method
CN105528365A (en) Method and device for managing executable files
CN112269644B (en) Verification method, system and device for subprocess calling and readable storage medium
CN105447398A (en) Data safety protection method and device
CN104506630A (en) Method, server and system for generating authority data on basis of user roles
CN116775087A (en) Thermal repair method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant