WO2019001335A1 - Application program packaging method and device and terminal device - Google Patents

Application program packaging method and device and terminal device Download PDF

Info

Publication number
WO2019001335A1
WO2019001335A1 PCT/CN2018/092165 CN2018092165W WO2019001335A1 WO 2019001335 A1 WO2019001335 A1 WO 2019001335A1 CN 2018092165 W CN2018092165 W CN 2018092165W WO 2019001335 A1 WO2019001335 A1 WO 2019001335A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
application
dex
specified
module
Prior art date
Application number
PCT/CN2018/092165
Other languages
French (fr)
Chinese (zh)
Inventor
黄银锋
Original Assignee
广州优视网络科技有限公司
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 广州优视网络科技有限公司 filed Critical 广州优视网络科技有限公司
Publication of WO2019001335A1 publication Critical patent/WO2019001335A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4434Reducing the memory space required by the program code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Definitions

  • the present invention relates to the field of the Internet, and specifically provides an application package method, apparatus, and terminal device.
  • the number of methods is defined in 65,535, if the number of functions exceeds 65,535, the virtual machine can not properly load the DEX file. Therefore, it will cause the Android application to report an error.
  • Google introduced a multidex solution when the application was packaged.
  • the Multidex solution is to divide the DEX file of more than 65,535 methods into multiple DEX files, and then load and merge back when the application starts, bypassing the Android virtual machine can not load 65,535 programs, multidex introduction,
  • the number of methods is more than 65,535, it does not meet the business expansion requirements, because multidex cannot be freely subcontracted according to the service package name. Therefore, the requirements for dividing a specific function code into a specific DEX file required by the Android componentized business cannot be satisfied.
  • an object of the embodiments of the present invention is to provide an application package method, apparatus, and terminal device, which are intended to implement a solution in which an Android specific service code can be divided into specific DEX files when packaged.
  • an embodiment of the present invention provides an application packaging method, where the method includes: acquiring a compressed file generated in a process of converting a Java file into a first DEX file, wherein the first DEX file is used to compress Entering an application file to obtain an application; decompressing the compressed file to obtain a decompressed file, the decompressed file including a specified file; selecting a specified file from the decompressed file; converting the specified file into a second DEX file; The second DEX file is pushed into the application file to obtain the application.
  • an embodiment of the present invention provides an application package device, where the device includes an acquisition module, a decompression module, a selection module, and a packaging module.
  • the obtaining module is configured to obtain a compressed file generated in a process of converting a Java file into a first DEX file, where the first DEX file is used to be pressed into an application file to obtain an application; and the decompression module is configured to decompress the compression.
  • the file is decompressed, the decompressed file includes a specified file, a selection module is configured to select the specified file from the decompressed file, a conversion module is configured to convert the specified file into a second DEX file, and a packaging module is configured to: The second DEX file is pushed into the application file to get the application.
  • an embodiment of the present invention provides a terminal device, including a processor, a memory, and an application packaging device.
  • the application packaging device is installed in the memory and includes one or more software function modules executed by the processor, the application packaging device including an acquisition module, a decompression module, a selection module, and a packaging module.
  • the obtaining module is configured to obtain a compressed file generated in a process of converting a Java file into a first DEX file, where the first DEX file is used to be pressed into an application file to obtain an application; and the decompression module is configured to decompress the compression.
  • the file is decompressed, the decompressed file includes a specified file, a selection module is configured to select the specified file from the decompressed file, a conversion module is configured to convert the specified file into a second DEX file, and a packaging module is configured to: The second DEX file is pushed into the application file to get the application.
  • an embodiment of the present invention provides a computer readable storage medium, where the one or more programs are stored, and the one or more programs are executed by a terminal device that includes multiple applications.
  • the terminal device is caused to perform the following operations:
  • the second DEX file is pushed into an application file to obtain the application.
  • the application package method includes: acquiring a compressed file generated in a process of converting a Java file into a first DEX file, wherein the first DEX file is used for Pressing into the application file to obtain an application; decompressing the compressed file to obtain a decompressed file, the decompressed file including a specified file; selecting the specified file from the decompressed file; converting the specified file into a second DEX file; The second DEX file is pushed into the application file to obtain the application.
  • the application package method, device and terminal device provided by the invention package the module of the specific package name into the second DEX file in the package process of the Android application, and package the partial independent service into the second DEX file, which is used by the user.
  • you go to the service you can load it again, you don't have to load it immediately when you start it, avoid the problem of long startup time, have better business model, and provide basic packaging support for dynamic loading scheme.
  • FIG. 1 is a schematic block diagram of a terminal device according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of an application packaging method according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of splitting a DEX file in the prior art.
  • FIG. 4 is a schematic diagram of splitting a DEX file according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a function module of an application packaging apparatus 110 according to an embodiment of the present invention.
  • Icon 100-terminal device; 110-application packaging device; 111-acquisition module; 112-decompression module; 113-selection module; 114-conversion module; 115-packaging module; 116-registration module; 117-compression module; - memory; 130-processor.
  • the application package method and device provided by the embodiments of the present invention are applied to a terminal device.
  • the terminal device may be, but not limited to, a personal computer (PC), a server.
  • FIG. 1 is a block diagram of the terminal device 100.
  • the terminal device 100 includes an application packaging device 110, a memory 120, and a processor 130.
  • the memory 120 and the processor 130 are electrically connected directly or indirectly to each other to implement data transmission or interaction.
  • the components can be electrically connected to one another via one or more communication buses or signal lines.
  • the application packaging device 110 includes at least one software function module that can be stored in the memory 120 or solidified in an operating system (OS) of the terminal device 100 in the form of software or firmware.
  • the processor 130 is configured to execute executable modules stored in the memory 120, such as software function modules, computer programs, and the like included in the application package device 110.
  • the memory 120 can be, but not limited to, a random access memory (RAM), a read only memory (ROM), and a programmable read-only memory (PROM). Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), and the like.
  • RAM random access memory
  • ROM read only memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read-Only Memory
  • EEPROM Electric Erasable Programmable Read-Only Memory
  • the memory 120 is used to store a program, and the processor 130 executes the program after receiving the execution instruction. Access to the memory 120 by the processor 130 and other possible components can be performed under the control of the memory controller 140.
  • the processor 130 can be an integrated circuit chip with signal processing capabilities.
  • the processor 130 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and may also be a digital signal processor (DSP), an application specific integrated circuit ( ASICs, Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present invention.
  • the general purpose processor may be a microprocessor, or the processor may be any conventional processor or the like.
  • the application packaging method provided by the embodiment of the present invention is applied to the terminal device 100.
  • the application packaging method includes the following steps:
  • Step S101 Acquire a compressed file generated during conversion of a Java file into a DEX file.
  • the packager needs to convert the Java code file into the first DEX file when packaging the source file implemented in Java code into an application.
  • the package tool needs to be a jar compression file.
  • the jar compression file is a executable code collection file compiled by the Java code, and the jar compression file is generated and then packaged into the first DEX file.
  • the packaging tool is a Gradle packaging tool.
  • Step S102 decompressing the compressed file to obtain a decompressed file, where the decompressed file includes a specified file.
  • the decompressed file includes a plurality of function codes, each of which has its own specific function.
  • the function code that needs to be used is delivered through built-in or online, thereby reducing the package.
  • the specified file is a function code that needs to be separately converted into the second DEX file.
  • Step S103 selecting a specified file from the decompressed file.
  • Step S104 converting the specified file into a second DEX file.
  • the specified file is converted into the second DEX file by the Gradle tool, and the conversion is performed according to a predetermined package path during the conversion process, so that the specific service is selected later, and the package path is obtained by pre-registration.
  • the specified file is placed in a preset folder according to a predetermined package path, and then the specified file is recompressed, and the compressed file is converted into a second DEX file by the Gradle tool.
  • Step S105 pressing the second DEX file into an application file to obtain the application.
  • This application file is an application package generated by the Gradle tool.
  • a non-designated file (a file other than the specified file in the function code)
  • it is recompressed, and the compressed file before decompression is replaced, and then the compressed file is packaged by the Gradle tool to generate an application file.
  • Step S106 performing signature verification on the application.
  • the packaging process of the application is completed, and the packaged application includes a plurality of second DEX files, each of which has a separate function service, and when the user needs to use a certain service in the later stage, Loading the second DEX file corresponding to the service does not need to be loaded immediately at startup, thereby avoiding the problem of long startup time.
  • FIG. 3 is a schematic diagram of dividing a DEX file of more than 65535 methods into a plurality of DEX files (ie, a first DEX file) in the prior art.
  • the function business in which the DEX file is split into DEX1, DEX2, DEX3...DEX files is disrupted, and may be merged into multiple DEXs that are split, for example, for functional service 1, merged in DEX1 and DEX2, Functional service 2 is integrated in DEX2 and DEX3.
  • Functional service 1 and functional service 2 it is necessary to load DEX1, DEX2 and DEX3 in sequence, which will undoubtedly increase the startup time.
  • the application packaged by the application package method provided by the embodiment of the present invention refers to FIG. 4, because each function service is separately packaged and converted into a DEX file (ie, a second DEX file) according to requirements during the packaging process, so each needs to be used.
  • the function business is a separate DEX file (ie the second DEX file), wherein the DEX file is split into DEX1', DEX2', DEX3'...
  • Function Service 1 is packaged in DEX1'
  • Function Service 2 is packaged in DEX2 'In the case, for example, when the user needs to use the function service 2, only need to load DEX2', no need to load DEX1' first, then load DEX2', and no need to load DEX3', saving startup time and meeting the needs of componentized business. , to achieve a dynamic loading scheme.
  • the application packaging apparatus 110 includes an obtaining module 111, a decompression module 112, a selection module 113, a conversion module 114, and a packaging module 115.
  • the obtaining module 111 is configured to obtain a compressed file generated during conversion of the Java file into the first DEX file, where the first DEX file is used to be pressed into the application file to obtain an application.
  • the obtaining module 111 is configured to perform step S101.
  • the packager needs to convert the Java code file into the first DEX file when packaging the source file implemented in Java code into an application.
  • the package tool needs to be a jar compression file.
  • the jar compression file is a executable code collection file compiled by the Java code, and the jar compression file is generated and then packaged into the first DEX file.
  • the packaging tool is a Gradle packaging tool. By writing a plug-in and using a command, the jar compression file that needs to be converted into the first DEX file is forcibly extracted, such as main.jar and proguard.jar, and the extraction command may be task.doFirst.
  • the decompression module 112 is configured to decompress the compressed file to obtain a decompressed file.
  • the decompression module 112 can be used to perform step S102.
  • the decompressed file includes a plurality of function codes, each of which has its own specific function.
  • the function code that needs to be used is delivered through built-in or online, thereby reducing the package.
  • the specified file is a function code that needs to be separately converted into the second DEX file.
  • the selection module 113 is configured to select the specified file from the decompressed file.
  • the selection module 113 can be used to perform step S103.
  • the conversion module 114 is configured to convert the specified file into a second DEX file.
  • the conversion module 114 can be used to perform step S104.
  • the specified file is converted into the second DEX file by the Gradle tool, and the conversion is performed according to a predetermined package path during the conversion process, so that the specific service is selected later, and the package path is obtained by pre-registration.
  • the specified file is placed in a preset folder according to a predetermined package path, and then the specified file is recompressed, and the compressed file is converted into a second DEX file by the Gradle tool.
  • the application package device 110 provided by the embodiment of the present invention further includes a registration module 116 for registering a package path.
  • the packaging module 115 is configured to push the second DEX file into an application file to obtain the application.
  • the packaging module 115 can be used to perform step S105. After the function codes that need to be separately packaged as the second DEX file are all converted into the second DEX file, the converted second DEX file is pushed into the application file to obtain an application.
  • This application file is an application package generated by the Gradle tool.
  • the application packaging device 110 further includes a compression module 117, for non-designated files (files other than the specified file in the function code), will be recompressed, replaced in the compressed file before decompression, and then passed through the Gradle tool. Package the compressed file to generate an application file.
  • the compression module 117 is configured to compress the non-specified file and replace the compressed file.
  • the application packaging device 110 can also include a signature module for performing signature verification on the application.
  • the embodiment of the present invention provides an application package method, device, and terminal device.
  • the application packaging method includes: obtaining a compressed file generated during conversion of the Java file into the first DEX file; decompressing the compressed file to obtain a decompressed file, the decompressed file including the specified file; and selecting the specified file from the decompressed file; Converting the specified file into a second DEX file; pushing the second DEX file into an application file to obtain the application.
  • the application package method, device and terminal device provided by the invention package the module of the specific package name into the second DEX file in the package process of the Android application, and package the partial independent service into the second DEX file, which is used by the user. When you go to the service, you can load it again, you don't have to load it immediately when you start it, avoid the problem of long startup time, have better business model, and provide basic packaging support for dynamic loading scheme.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the DEX instruction. It should also be noted that, in some alternative implementations, the functions noted in the blocks may also occur in a different order than those illustrated in the drawings.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or function. Or it can be implemented by a combination of dedicated hardware and computer instructions.
  • each functional module in each embodiment of the present invention may be integrated to form a separate part, or each module may exist separately, or two or more modules may be integrated to form a separate part.
  • the functions, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

An application program packaging method and device, and a terminal device. The application program packaging method comprising: acquiring a compressed file generated in the process of converting a Java file to a DEX file (S101); decompressing the compressed file to obtain a decompressed file, the decompressed file comprising a specified file (S102); selecting the specified file from the decompressed file (S103); converting the specified file to a second DEX file (S104); and compressing the second DEX file into an application file to obtain the application program (105). The provided application program packaging method and device and the terminal device package separately a module of a specific package name into a second DEX file and package a part of independent services into a second DEX file during the packaging process of an Android application program, so that the services are loaded when a user needs the services and the process of immediately loading the services upon start-up is avoided. Therefore, the problem of long start-up time is solved; a better service mode is provided; and basic packaging support is provided for a dynamic loading scheme.

Description

应用程序打包方法、装置及终端设备Application packaging method, device and terminal device
交互参考Cross reference
本申请要求以下优先权:2017年6月29日提出的申请号:201710530952.8,名称:“应用程序打包方法、装置及终端设备”的中国专利,本申请参考引用了如上所述申请的全部内容。The present application claims the following priority: Application No.: 201710530952.8, entitled: "Application Package Method, Apparatus, and Terminal Equipment", the entire contents of which are hereby incorporated by reference.
技术领域Technical field
本发明涉及互联网领域,具体提供了一种应用程序打包方法、装置及终端设备。The present invention relates to the field of the Internet, and specifically provides an application package method, apparatus, and terminal device.
背景技术Background technique
目前,安卓开发工具AndrodStudio在应用程序打包过程中,由于安卓虚拟机机制的缘故,其方法数被定义在65535个,如果函数个数超过65535个,虚拟机就无法正常加载DEX文件。因此也就会导致安卓应用程序报错。谷歌公司为了解决这个问题,在应用程序打包时,引入了multidex的解决方案。Multidex解决方案的做法是将超过65535个方法的DEX文件,分成多个DEX文件,然后在应用程序启动的时候再依次加载合并回去,绕过了安卓虚拟机不能加载65535个方案,multidex的引入,虽然解决了方法数超过65535个,但却不能满足业务扩展需求,因为multidex不能根据业务包名单独自由分包。因此不能满足安卓组件化业务所需的将特定功能代码分成特定DEX文件的需求。At present, Android development tool AndrodStudio in the application packaging process, due to the Android virtual machine mechanism, the number of methods is defined in 65,535, if the number of functions exceeds 65,535, the virtual machine can not properly load the DEX file. Therefore, it will cause the Android application to report an error. In order to solve this problem, Google introduced a multidex solution when the application was packaged. The Multidex solution is to divide the DEX file of more than 65,535 methods into multiple DEX files, and then load and merge back when the application starts, bypassing the Android virtual machine can not load 65,535 programs, multidex introduction, Although the number of methods is more than 65,535, it does not meet the business expansion requirements, because multidex cannot be freely subcontracted according to the service package name. Therefore, the requirements for dividing a specific function code into a specific DEX file required by the Android componentized business cannot be satisfied.
发明内容Summary of the invention
有鉴于此,本发明实施例的目的在于提供一种应用程序打包方法、装置及终端设备,旨在实现安卓特定业务代码在打包时可以分成特定DEX文件的解决方案。In view of this, an object of the embodiments of the present invention is to provide an application package method, apparatus, and terminal device, which are intended to implement a solution in which an Android specific service code can be divided into specific DEX files when packaged.
为了达到上述的目的,本发明实施例采用的技术方案如下所述:In order to achieve the above objective, the technical solution adopted by the embodiment of the present invention is as follows:
第一方面,本发明实施例提供了一种应用程序打包方法,所述方法包括:获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;解压所述压缩文件得到解压文件,所述解压文件包括指定文件;从所述解压文件中选中指定文件;将所述指定文件转换成第二DEX文件;将所述第二DEX文件压入应用文件以得到所述应用程序。In a first aspect, an embodiment of the present invention provides an application packaging method, where the method includes: acquiring a compressed file generated in a process of converting a Java file into a first DEX file, wherein the first DEX file is used to compress Entering an application file to obtain an application; decompressing the compressed file to obtain a decompressed file, the decompressed file including a specified file; selecting a specified file from the decompressed file; converting the specified file into a second DEX file; The second DEX file is pushed into the application file to obtain the application.
第二方面,本发明实施例提供了一种应用程序打包装置,所述装置包括获取模块、解压模块、选择模块以及打包模块。其中获取模块用于获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;解压模块用于解压所述压缩文件得到解压文件,所述解压文件包括指定文件;选择模块用于从所述解压文件中选中指定文件;转换模块用于将所述指定文件转换成第二DEX文件;打包模块用于将所述第二DEX文件压入应用文件以得到所述应用程序。In a second aspect, an embodiment of the present invention provides an application package device, where the device includes an acquisition module, a decompression module, a selection module, and a packaging module. The obtaining module is configured to obtain a compressed file generated in a process of converting a Java file into a first DEX file, where the first DEX file is used to be pressed into an application file to obtain an application; and the decompression module is configured to decompress the compression. The file is decompressed, the decompressed file includes a specified file, a selection module is configured to select the specified file from the decompressed file, a conversion module is configured to convert the specified file into a second DEX file, and a packaging module is configured to: The second DEX file is pushed into the application file to get the application.
第三方面,本发明实施例提供了一种终端设备,包括处理器、存储器以及应用程序打包装置。所述应用程序打包装置安装于所述存储器中并包括一个或多个由所述处理器执行的软件功能模块,所述应用程序打包装置包括获取模块、解压模块、选择模块以及打包模块。其中获取模块用于获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;解压模块用于解压所述压缩文件得到解压文件,所述解压文件包括指定文件;选择模块用于从所述解压文件中选中指定文件;转换模块用于将所述指定文件转换成第二DEX文件;打包模块用于将所述第二DEX文件压入应用文件以得到所述应用程序。In a third aspect, an embodiment of the present invention provides a terminal device, including a processor, a memory, and an application packaging device. The application packaging device is installed in the memory and includes one or more software function modules executed by the processor, the application packaging device including an acquisition module, a decompression module, a selection module, and a packaging module. The obtaining module is configured to obtain a compressed file generated in a process of converting a Java file into a first DEX file, where the first DEX file is used to be pressed into an application file to obtain an application; and the decompression module is configured to decompress the compression. The file is decompressed, the decompressed file includes a specified file, a selection module is configured to select the specified file from the decompressed file, a conversion module is configured to convert the specified file into a second DEX file, and a packaging module is configured to: The second DEX file is pushed into the application file to get the application.
第四方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储一个或多个程序,所述一个或多个程序当被包括多个应用程序的终端设备执行时,使得所述终端设备执行以下操作:In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium, where the one or more programs are stored, and the one or more programs are executed by a terminal device that includes multiple applications. When the terminal device is caused to perform the following operations:
获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;Obtaining a compressed file generated in a process of converting a Java file into a first DEX file, wherein the first DEX file is used to be pressed into an application file to obtain an application;
解压所述压缩文件得到解压文件,所述解压文件包括指定文件;Decompressing the compressed file to obtain a decompressed file, where the decompressed file includes a specified file;
从所述解压文件中选中指定文件;Selecting the specified file from the decompressed file;
将所述指定文件转换成第二DEX文件;Converting the specified file into a second DEX file;
将所述第二DEX文件压入应用文件以得到所述应用程序。The second DEX file is pushed into an application file to obtain the application.
本发明实施例提供的应用程序打包方法、装置及终端设备,该应用程序打包方法包括:获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;解压所述压缩文件得到解压文件,所述解压文件包括指定文件;从所述解压文件中选中指定文件;将所述指定文件转换成第二DEX文件;将所述第二DEX文件压入应用文件以得到所述应用程序。本发明提供的应用程序打包方法、装置及终端设备在安卓应用程序打包过程中,将特定包名的模块单独打包成第二DEX文件,将部分独立的业务打包成第二DEX文件,在用户用到该业务时再去加载,不必启动时立刻去加载,避免启动时间长的问题,有着更好的业务模式,为动态加载方案提供基础的打包支持。The application package method, apparatus, and terminal device provided by the embodiment of the present invention, the application package method includes: acquiring a compressed file generated in a process of converting a Java file into a first DEX file, wherein the first DEX file is used for Pressing into the application file to obtain an application; decompressing the compressed file to obtain a decompressed file, the decompressed file including a specified file; selecting the specified file from the decompressed file; converting the specified file into a second DEX file; The second DEX file is pushed into the application file to obtain the application. The application package method, device and terminal device provided by the invention package the module of the specific package name into the second DEX file in the package process of the Android application, and package the partial independent service into the second DEX file, which is used by the user. When you go to the service, you can load it again, you don't have to load it immediately when you start it, avoid the problem of long startup time, have better business model, and provide basic packaging support for dynamic loading scheme.
本申请附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本申请的实践了解到。The aspects and advantages of the present invention will be set forth in part in the description which follows.
附图说明DRAWINGS
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present invention will become apparent and readily understood from
图1是本发明实施例提供的终端设备的方框示意图。FIG. 1 is a schematic block diagram of a terminal device according to an embodiment of the present invention.
图2是本发明实施例提供的应用程序打包方法的流程图。FIG. 2 is a flowchart of an application packaging method according to an embodiment of the present invention.
图3是现有技术中对DEX文件的拆分示意图。FIG. 3 is a schematic diagram of splitting a DEX file in the prior art.
图4是本发明实施例对DEX文件的拆分示意图。4 is a schematic diagram of splitting a DEX file according to an embodiment of the present invention.
图5是本发明实施例提供的应用程序打包装置110的功能模块架构示意图。FIG. 5 is a schematic structural diagram of a function module of an application packaging apparatus 110 according to an embodiment of the present invention.
图标:100-终端设备;110-应用程序打包装置;111-获取模块;112-解压模块;113-选择模块;114-转换模块;115-打包模块;116-注册模块;117-压缩模块;120-存储器;130-处理器。Icon: 100-terminal device; 110-application packaging device; 111-acquisition module; 112-decompression module; 113-selection module; 114-conversion module; 115-packaging module; 116-registration module; 117-compression module; - memory; 130-processor.
具体实施方式Detailed ways
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本申请的限制。The embodiments of the present application are described in detail below, and the examples of the embodiments are illustrated in the drawings, wherein the same or similar reference numerals are used to refer to the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are intended to be illustrative only, and are not to be construed as limiting.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。It should be noted that similar reference numerals and letters indicate similar items in the following figures. Therefore, once an item is defined in one figure, it is not necessary to further define and explain it in the subsequent figures.
本发明实施例提供的应用程序打包方法及装置应用于终端设备。该终端设备可以是,但不限于,个人电脑(personal computer,PC)、服务器。The application package method and device provided by the embodiments of the present invention are applied to a terminal device. The terminal device may be, but not limited to, a personal computer (PC), a server.
请参照图1,是该终端设备100的方框示意图。该终端设备100包括应用程序打包装置110、存储器120和处理器130。Please refer to FIG. 1, which is a block diagram of the terminal device 100. The terminal device 100 includes an application packaging device 110, a memory 120, and a processor 130.
存储器120、处理器130相互之间直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条或多条通讯总线或信号线实现电性连接。应用程序打包装置110包括至少一个可以软件或固件(firmware)的形式存储于存储器120中或固化在终端设备100的操作系统(operating system,OS)中的软件功能模块。处理器130用于执行所述存储器120中存储的可执行模块,例如应用程序打包装置110所包括的软件功能模块及计算机程序等。The memory 120 and the processor 130 are electrically connected directly or indirectly to each other to implement data transmission or interaction. For example, the components can be electrically connected to one another via one or more communication buses or signal lines. The application packaging device 110 includes at least one software function module that can be stored in the memory 120 or solidified in an operating system (OS) of the terminal device 100 in the form of software or firmware. The processor 130 is configured to execute executable modules stored in the memory 120, such as software function modules, computer programs, and the like included in the application package device 110.
其中,存储器120可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。其中,存储器120用于存储程序,处理器130在接收到执行指令后,执行该程序。处理器130以及其他可能的组件对存储器120的访问可在存储控制器140的控制下进行。The memory 120 can be, but not limited to, a random access memory (RAM), a read only memory (ROM), and a programmable read-only memory (PROM). Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), and the like. The memory 120 is used to store a program, and the processor 130 executes the program after receiving the execution instruction. Access to the memory 120 by the processor 130 and other possible components can be performed under the control of the memory controller 140.
处理器130可以是一种集成电路芯片,具有信号的处理能力。上述的 处理器130可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(DSP))、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。该通用处理器可以是微处理器,或者该处理器也可以是任何常规的处理器等。The processor 130 can be an integrated circuit chip with signal processing capabilities. The processor 130 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and may also be a digital signal processor (DSP), an application specific integrated circuit ( ASICs, Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present invention. The general purpose processor may be a microprocessor, or the processor may be any conventional processor or the like.
本发明实施例提供的应用程序打包方法应用于终端设备100,请参照图2,该应用程序打包方法包括以下步骤:The application packaging method provided by the embodiment of the present invention is applied to the terminal device 100. Referring to FIG. 2, the application packaging method includes the following steps:
步骤S101,获取Java文件转换为DEX文件过程中产生的压缩文件。Step S101: Acquire a compressed file generated during conversion of a Java file into a DEX file.
打包程序在将以Java代码实现的源文件打包成应用程序时,需要将Java代码文件转为第一DEX文件。打包工具在将Java代码文件优化为第一DEX文件前,需先生成jar压缩文件,jar压缩文件为Java代码编译后的可执行代码集合文件,jar压缩文件生成后再打包成第一DEX文件。本发明实施例中,打包工具为Gradle打包工具,通过编写插件,使用命令,强行将需要被转换为第一DEX文件的jar压缩文件提取出来,如main.jar、proguard.jar,提取命令可为task.doFirst。The packager needs to convert the Java code file into the first DEX file when packaging the source file implemented in Java code into an application. Before the Java tool file is optimized to the first DEX file, the package tool needs to be a jar compression file. The jar compression file is a executable code collection file compiled by the Java code, and the jar compression file is generated and then packaged into the first DEX file. In the embodiment of the present invention, the packaging tool is a Gradle packaging tool. By writing a plug-in and using a command, the jar compression file that needs to be converted into the first DEX file is forcibly extracted, such as main.jar and proguard.jar, and the extraction command may be task.doFirst.
步骤S102,解压所述压缩文件得到解压文件,所述解压文件包括指定文件。Step S102, decompressing the compressed file to obtain a decompressed file, where the decompressed file includes a specified file.
解压后的文件中,包括多个功能代码,这些功能代码具有各自特定的功能,在组件化业务中,需要用到的功能代码通过内置或者在线下发,起到降低包体的目的。本发明实施例中,指定文件为需要单独转换为第二DEX文件的功能代码。The decompressed file includes a plurality of function codes, each of which has its own specific function. In the componentized service, the function code that needs to be used is delivered through built-in or online, thereby reducing the package. In the embodiment of the present invention, the specified file is a function code that needs to be separately converted into the second DEX file.
步骤S103,从所述解压文件中选中指定文件。Step S103, selecting a specified file from the decompressed file.
步骤S104,将所述指定文件转换为第二DEX文件。Step S104, converting the specified file into a second DEX file.
在本实施例中,通过Gradle工具将指定文件转换为第二DEX文件,在转换过程中,按照预定的包路径进行转换,方便后期选取特定业务,包路径通过预先注册得到。具体的,将指定文件按照预定的包路径放入预设的文件夹中,再重新压缩指定文件,通过Gradle工具将压缩文件转换为第二DEX文件。In this embodiment, the specified file is converted into the second DEX file by the Gradle tool, and the conversion is performed according to a predetermined package path during the conversion process, so that the specific service is selected later, and the package path is obtained by pre-registration. Specifically, the specified file is placed in a preset folder according to a predetermined package path, and then the specified file is recompressed, and the compressed file is converted into a second DEX file by the Gradle tool.
步骤S105,将所述第二DEX文件压入应用文件以得到所述应用程序。Step S105, pressing the second DEX file into an application file to obtain the application.
当需要单独打包为第二DEX文件的功能代码全部转换为第二DEX文件之后,将转换得到的第二DEX文件压入应用文件中,得到应用程序。该应用文件为Gradle工具生成的应用程序包。After the function codes that need to be separately packaged into the second DEX file are all converted into the second DEX file, the converted second DEX file is pushed into the application file to obtain an application. This application file is an application package generated by the Gradle tool.
在本实施例中,对于非指定文件(功能代码中除指定文件外的文件),会被重新压缩,并替换解压前的压缩文件,然后再通过Gradle工具进行对压缩文件打包以生成应用文件。In this embodiment, for a non-designated file (a file other than the specified file in the function code), it is recompressed, and the compressed file before decompression is replaced, and then the compressed file is packaged by the Gradle tool to generate an application file.
步骤S106,对所述应用程序进行签名校验。Step S106, performing signature verification on the application.
通过上述步骤,即完成应用程序的打包过程,打包后的应用程序包括多个第二DEX文件,每一个第二DEX文件具有单独的功能业务,在后期用户需要用到某一业务时,再去加载与该业务对应的第二DEX文件,不需要在启动时立即去加载,避免了启动时间长的问题。为使本发明实施例更易理解,请参照图3,是现有技术中,将超过65535个方法的DEX文件分成多个DEX文件(即第一DEX文件)的示意图。其中,DEX文件被拆分成DEX1、DEX2、DEX3…DEX文件中的功能业务被打乱,可能融合在拆分出来的多个DEX中,例如,对于功能业务1,融合在DEX1和DEX2中,功能业务2融合在DEX2和DEX3中,要实现功能业务1和功能业务2,需要依次加载DEX1、DEX2和DEX3,这无疑将增加启动时间。本发明实施例提供的应用程序打包方法打包的应用程序请参照图4,由于在打包过程中,各个功能业务根据需要单独打包转换为DEX文件(即第二DEX文件),所以每个需要用到的功能业务为单独的DEX文件(即第二DEX文件),其中,DEX文件被拆分成DEX1’、DEX2’、DEX3’…功能业务1被打包在DEX1’中,功能业务2被打包在DEX2’中,例如,在用户需要使用功能业务2时,只需要加载DEX2’即可,无需先加载DEX1’,再加载DEX2’,也无需加载DEX3’,节约了启动时间,满足组件化业务的需求,实现动态加载方案。Through the above steps, the packaging process of the application is completed, and the packaged application includes a plurality of second DEX files, each of which has a separate function service, and when the user needs to use a certain service in the later stage, Loading the second DEX file corresponding to the service does not need to be loaded immediately at startup, thereby avoiding the problem of long startup time. In order to make the embodiment of the present invention easier to understand, please refer to FIG. 3, which is a schematic diagram of dividing a DEX file of more than 65535 methods into a plurality of DEX files (ie, a first DEX file) in the prior art. Among them, the function business in which the DEX file is split into DEX1, DEX2, DEX3...DEX files is disrupted, and may be merged into multiple DEXs that are split, for example, for functional service 1, merged in DEX1 and DEX2, Functional service 2 is integrated in DEX2 and DEX3. To implement functional service 1 and functional service 2, it is necessary to load DEX1, DEX2 and DEX3 in sequence, which will undoubtedly increase the startup time. The application packaged by the application package method provided by the embodiment of the present invention refers to FIG. 4, because each function service is separately packaged and converted into a DEX file (ie, a second DEX file) according to requirements during the packaging process, so each needs to be used. The function business is a separate DEX file (ie the second DEX file), wherein the DEX file is split into DEX1', DEX2', DEX3'... Function Service 1 is packaged in DEX1', and Function Service 2 is packaged in DEX2 'In the case, for example, when the user needs to use the function service 2, only need to load DEX2', no need to load DEX1' first, then load DEX2', and no need to load DEX3', saving startup time and meeting the needs of componentized business. , to achieve a dynamic loading scheme.
请参照图5,是本发明实施例提供的应用程序打包装置110的功能模块架构示意图,该应用程序打包装置110包括获取模块111、解压模块112、选择模块113、转换模块114和打包模块115。5 is a schematic diagram of a functional module architecture of an application packaging apparatus 110 according to an embodiment of the present invention. The application packaging apparatus 110 includes an obtaining module 111, a decompression module 112, a selection module 113, a conversion module 114, and a packaging module 115.
其中,获取模块111用于获取Java文件转换为第一DEX文件过程中产生的压缩文件,所述第一DEX文件用于压入应用文件中以得到应用程序。The obtaining module 111 is configured to obtain a compressed file generated during conversion of the Java file into the first DEX file, where the first DEX file is used to be pressed into the application file to obtain an application.
在本实施例中,获取模块111可用于执行步骤S101。打包程序在将以Java代码实现的源文件打包成应用程序时,需要将Java代码文件转为第一DEX文件。打包工具在将Java代码文件优化为第一DEX文件前,需先生成jar压缩文件,jar压缩文件为Java代码编译后的可执行代码集合文件,jar压缩文件生成后再打包成第一DEX文件。本发明实施例中,打包工具为Gradle打包工具,通过编写插件,使用命令,强行将需要被转换为第一DEX文件的jar压缩文件提取出来,如main.jar、proguard.jar,提取命令可为task.doFirst。In this embodiment, the obtaining module 111 is configured to perform step S101. The packager needs to convert the Java code file into the first DEX file when packaging the source file implemented in Java code into an application. Before the Java tool file is optimized to the first DEX file, the package tool needs to be a jar compression file. The jar compression file is a executable code collection file compiled by the Java code, and the jar compression file is generated and then packaged into the first DEX file. In the embodiment of the present invention, the packaging tool is a Gradle packaging tool. By writing a plug-in and using a command, the jar compression file that needs to be converted into the first DEX file is forcibly extracted, such as main.jar and proguard.jar, and the extraction command may be task.doFirst.
解压模块112用于解压所述压缩文件得到解压文件。The decompression module 112 is configured to decompress the compressed file to obtain a decompressed file.
在本实施例中,解压模块112可用于执行步骤S102。解压后的文件中,包括多个功能代码,这些功能代码具有各自特定的功能,在组件化业务中,需要用到的功能代码通过内置或者在线下发,起到降低包体的目的。本发明实施例中,指定文件为需要单独转换为第二DEX文件的功能代码。In this embodiment, the decompression module 112 can be used to perform step S102. The decompressed file includes a plurality of function codes, each of which has its own specific function. In the componentized service, the function code that needs to be used is delivered through built-in or online, thereby reducing the package. In the embodiment of the present invention, the specified file is a function code that needs to be separately converted into the second DEX file.
选择模块113用于从所述解压文件中选中指定文件。The selection module 113 is configured to select the specified file from the decompressed file.
在本实施例中,选择模块113可用于执行步骤S103。In this embodiment, the selection module 113 can be used to perform step S103.
转换模块114用于将所述指定文件转换成第二DEX文件。The conversion module 114 is configured to convert the specified file into a second DEX file.
在本实施例中,转换模块114可用于执行步骤S104。在本实施例中,通过Gradle工具将指定文件转换为第二DEX文件,在转换过程中,按照预定的包路径进行转换,方便后期选取特定业务,包路径通过预先注册得到。具体的,将指定文件按照预定的包路径放入预设的文件夹中,再重新压缩指定文件,通过Gradle工具将压缩文件转换为第二DEX文件。本发明实施例提供的应用程序打包装置110还包括注册模块116,用于注册包路径。In this embodiment, the conversion module 114 can be used to perform step S104. In this embodiment, the specified file is converted into the second DEX file by the Gradle tool, and the conversion is performed according to a predetermined package path during the conversion process, so that the specific service is selected later, and the package path is obtained by pre-registration. Specifically, the specified file is placed in a preset folder according to a predetermined package path, and then the specified file is recompressed, and the compressed file is converted into a second DEX file by the Gradle tool. The application package device 110 provided by the embodiment of the present invention further includes a registration module 116 for registering a package path.
打包模块115用于将所述第二DEX文件压入应用文件以得到所述应用程序。The packaging module 115 is configured to push the second DEX file into an application file to obtain the application.
在本实施例中,打包模块115可用于执行步骤S105。当需要单独打 包为第二DEX文件的功能代码全部转换为第二DEX文件之后,将转换得到的第二DEX文件压入应用文件中,得到应用程序。该应用文件为Gradle工具生成的应用程序包。In this embodiment, the packaging module 115 can be used to perform step S105. After the function codes that need to be separately packaged as the second DEX file are all converted into the second DEX file, the converted second DEX file is pushed into the application file to obtain an application. This application file is an application package generated by the Gradle tool.
进一步地,该应用程序打包装置110还包括压缩模块117,对于非指定文件(功能代码中除指定文件外的文件),会被重新压缩,并替换解压前的压缩文件中,然后再通过Gradle工具进行对压缩文件打包以生成应用文件。压缩模块117用于将非指定文件压缩,并替换所述压缩文件。Further, the application packaging device 110 further includes a compression module 117, for non-designated files (files other than the specified file in the function code), will be recompressed, replaced in the compressed file before decompression, and then passed through the Gradle tool. Package the compressed file to generate an application file. The compression module 117 is configured to compress the non-specified file and replace the compressed file.
该应用程序打包装置110还可包括签名模块,用于对所述应用程序进行签名校验。The application packaging device 110 can also include a signature module for performing signature verification on the application.
综上所述,本发明实施例提供了一种应用程序打包方法、装置及终端设备。该应用程序打包方法包括:获取Java文件转换为第一DEX文件过程中产生的压缩文件;解压所述压缩文件得到解压文件,所述解压文件包括指定文件;从所述解压文件中选中指定文件;将所述指定文件转换成第二DEX文件;将所述第二DEX文件压入应用文件以得到所述应用程序。本发明提供的应用程序打包方法、装置及终端设备在安卓应用程序打包过程中,将特定包名的模块单独打包成第二DEX文件,将部分独立的业务打包成第二DEX文件,在用户用到该业务时再去加载,不必启动时立刻去加载,避免启动时间长的问题,有着更好的业务模式,为动态加载方案提供基础的打包支持。In summary, the embodiment of the present invention provides an application package method, device, and terminal device. The application packaging method includes: obtaining a compressed file generated during conversion of the Java file into the first DEX file; decompressing the compressed file to obtain a decompressed file, the decompressed file including the specified file; and selecting the specified file from the decompressed file; Converting the specified file into a second DEX file; pushing the second DEX file into an application file to obtain the application. The application package method, device and terminal device provided by the invention package the module of the specific package name into the second DEX file in the package process of the Android application, and package the partial independent service into the second DEX file, which is used by the user. When you go to the service, you can load it again, you don't have to load it immediately when you start it, avoid the problem of long startup time, have better business model, and provide basic packaging support for dynamic loading scheme.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本发明的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的DEX指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以 及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may also be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and functionality of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. operating. In this regard, each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the DEX instruction. It should also be noted that, in some alternative implementations, the functions noted in the blocks may also occur in a different order than those illustrated in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, can be implemented in a dedicated hardware-based system that performs the specified function or function. Or it can be implemented by a combination of dedicated hardware and computer instructions.
另外,在本发明各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。In addition, each functional module in each embodiment of the present invention may be integrated to form a separate part, or each module may exist separately, or two or more modules may be integrated to form a separate part.
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。The functions, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. . It should be noted that, in this context, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations. There is any such actual relationship or order between them. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。The above description is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention. It should be noted that similar reference numerals and letters indicate similar items in the following figures. Therefore, once an item is defined in one figure, it is not necessary to further define and explain it in the subsequent figures.

Claims (18)

  1. 一种应用程序打包方法,其特征在于,所述方法包括:An application packaging method, the method comprising:
    获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;Obtaining a compressed file generated in a process of converting a Java file into a first DEX file, wherein the first DEX file is used to be pressed into an application file to obtain an application;
    解压所述压缩文件得到解压文件,所述解压文件包括指定文件;Decompressing the compressed file to obtain a decompressed file, where the decompressed file includes a specified file;
    从所述解压文件中选中指定文件;Selecting the specified file from the decompressed file;
    将所述指定文件转换成第二DEX文件;Converting the specified file into a second DEX file;
    将所述第二DEX文件压入应用文件以得到所述应用程序。The second DEX file is pushed into an application file to obtain the application.
  2. 根据权利要求1所述的应用程序打包方法,其特征在于,所述指定文件为需要单独转换为第二DEX文件的功能代码;The application packaging method according to claim 1, wherein the specified file is a function code that needs to be separately converted into a second DEX file;
    所述第二DEX文件具有单独的功能业务。The second DEX file has a separate functional service.
  3. 根据权利要求1所述的应用程序打包方法,其特征在于,所述将所述指定文件转换成第二DEX文件的步骤包括:The application packaging method according to claim 1, wherein the converting the specified file into the second DEX file comprises:
    将所述指定文件按预定的包路径转换成第二DEX文件。Converting the specified file into a second DEX file in a predetermined package path.
  4. 根据权利要求3所述的应用程序打包方法,其特征在于,所述将所述指定文件按预定的包路径生成第二DEX文件的步骤包括:The application packaging method according to claim 3, wherein the step of generating the second DEX file by the specified file according to a predetermined package path comprises:
    将所述指定文件按预定的包路径放入预设的文件夹中;Putting the specified file into a preset folder according to a predetermined package path;
    压缩所述指定文件;Compressing the specified file;
    将压缩后的所述指定文件转换成第二DEX文件。Converting the compressed specified file into a second DEX file.
  5. 根据权利要求3所述的应用程序打包方法,其特征在于,所述方法还包括:The application packaging method according to claim 3, wherein the method further comprises:
    注册所述包路径。Register the package path.
  6. 根据权利要求1-5任一所述的应用程序打包方法,其特征在于,所述解压文件包括非指定文件,所述方法还包括:The application packaging method according to any one of claims 1 to 5, wherein the decompressing file includes a non-designated file, the method further comprising:
    将非指定文件压缩,并替换所述压缩文件。Compress the non-specified file and replace the compressed file.
  7. 根据权利要求6所述的应用程序打包方法,其特征在于,所述将非指定文件压缩回所述压缩文件中的步骤之后还包括步骤:The application packaging method according to claim 6, wherein the step of compressing the non-designated file back into the compressed file further comprises the steps of:
    通过Gradle工具继续对所述压缩文件进行打包以生成所述应用文件。The compressed file continues to be packaged by the Gradle tool to generate the application file.
  8. 根据权利要求1所述的应用程序打包方法,其特征在于,所述方法还包括:The application packaging method according to claim 1, wherein the method further comprises:
    对所述应用程序进行签名校验。Perform signature verification on the application.
  9. 一种应用程序打包装置,其特征在于,所述装置包括:An application packaging device, characterized in that the device comprises:
    获取模块,用于获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;An obtaining module, configured to obtain a compressed file generated in a process of converting a Java file into a first DEX file, where the first DEX file is used to be pressed into an application file to obtain an application;
    解压模块,用于解压所述压缩文件得到解压文件,所述解压文件包括指定文件;a decompression module, configured to decompress the compressed file to obtain a decompressed file, where the decompressed file includes a specified file;
    选择模块,用于从所述解压文件中选中指定文件;a selection module, configured to select a specified file from the decompressed file;
    转换模块,用于将所述指定文件转换成第二DEX文件;a conversion module, configured to convert the specified file into a second DEX file;
    打包模块,用于将所述第二DEX文件压入应用文件以得到所述应用程序。a packaging module, configured to push the second DEX file into an application file to obtain the application.
  10. 根据权利要求9所述的应用程序打包装置,其特征在于,所述指定文件为需要单独转换为第二DEX文件的功能代码;The application packaging device according to claim 9, wherein the specified file is a function code that needs to be separately converted into a second DEX file;
    所述第二DEX文件具有单独的功能业务。The second DEX file has a separate functional service.
  11. 根据权利要求9所述的应用程序打包装置,其特征在于,所述转换模块用于将所述指定文件按预定的包路径转换成第二DEX文件。The application packaging apparatus according to claim 9, wherein said conversion module is configured to convert said specified file into a second DEX file in a predetermined package path.
  12. 根据权利要求11所述的应用程序打包装置,其特征在于,所述转换模块用于将所述指定文件按预定的包路径放入预设的文件夹中,压缩所述指定文件,将压缩后的所述指定文件转换成第二DEX文件。The application package device according to claim 11, wherein the conversion module is configured to put the specified file into a preset folder according to a predetermined package path, compress the specified file, and compress the file. The specified file is converted into a second DEX file.
  13. 根据权利要求11所述的应用程序打包装置,其特征在于,所述装置还包括注册模块,用于注册所述包路径。The application packaging apparatus according to claim 11, wherein said apparatus further comprises a registration module for registering said packet path.
  14. 根据权利要求9-13任一所述的应用程序打包装置,其特征在于,所述解压文件包括非指定文件,所述装置还包括压缩模块,用于将非指定文件压缩,并替换所述压缩文件。The application packaging apparatus according to any one of claims 9-13, wherein said decompressing file comprises a non-designated file, said apparatus further comprising a compression module for compressing the non-specified file and replacing said compression file.
  15. 根据权利要求14所述的应用程序打包装置,其特征在于,所述打包模块还用于通过Gradle工具继续对所述压缩文件进行打包以生成所述应用文件。The application packaging apparatus according to claim 14, wherein the packaging module is further configured to continue to package the compressed file to generate the application file by using a Gradle tool.
  16. 根据权利要求9所述的应用程序打包装置,其特征在于,所述装置还包括签名模块,用于对所述应用程序进行签名校验。The application packaging apparatus according to claim 9, wherein said apparatus further comprises a signature module for performing signature verification on said application.
  17. 一种终端设备,其特征在于,包括:A terminal device, comprising:
    处理器;processor;
    存储器;以及Memory;
    应用程序打包装置,所述应用程序打包装置安装于所述存储器中并包括一个或多个由所述处理器执行的软件功能模块,所述应用程序打包装置包括:An application packaging device, the application packaging device being installed in the memory and comprising one or more software function modules executed by the processor, the application packaging device comprising:
    获取模块,用于获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;An obtaining module, configured to obtain a compressed file generated in a process of converting a Java file into a first DEX file, where the first DEX file is used to be pressed into an application file to obtain an application;
    解压模块,用于解压所述压缩文件得到解压文件,所述解压文件包括指定文件;a decompression module, configured to decompress the compressed file to obtain a decompressed file, where the decompressed file includes a specified file;
    选择模块,用于从所述解压文件中选中指定文件;a selection module, configured to select a specified file from the decompressed file;
    转换模块,用于将所述指定文件转换成第二DEX文件;a conversion module, configured to convert the specified file into a second DEX file;
    打包模块,用于将所述第二DEX文件压入应用文件以得到所述应用程序。a packaging module, configured to push the second DEX file into an application file to obtain the application.
  18. 一种计算机可读存储介质,所述计算机可读存储介质存储一个或多个程序,所述一个或多个程序当被包括多个应用程序的终端设备执行时,使得所述终端设备执行以下操作:A computer readable storage medium storing one or more programs, the one or more programs, when executed by a terminal device including a plurality of applications, causing the terminal device to perform the following operations :
    获取Java文件转换为第一DEX文件的过程中产生的压缩文件,其中,所述第一DEX文件用于压入应用文件中以得到应用程序;Obtaining a compressed file generated in a process of converting a Java file into a first DEX file, wherein the first DEX file is used to be pressed into an application file to obtain an application;
    解压所述压缩文件得到解压文件,所述解压文件包括指定文件;Decompressing the compressed file to obtain a decompressed file, where the decompressed file includes a specified file;
    从所述解压文件中选中指定文件;Selecting the specified file from the decompressed file;
    将所述指定文件转换成第二DEX文件;Converting the specified file into a second DEX file;
    将所述第二DEX文件压入应用文件以得到所述应用程序。The second DEX file is pushed into an application file to obtain the application.
PCT/CN2018/092165 2017-06-29 2018-06-21 Application program packaging method and device and terminal device WO2019001335A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710530952.8A CN107315593A (en) 2017-06-29 2017-06-29 application program packaging method, device and terminal device
CN201710530952.8 2017-06-29

Publications (1)

Publication Number Publication Date
WO2019001335A1 true WO2019001335A1 (en) 2019-01-03

Family

ID=60179998

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/092165 WO2019001335A1 (en) 2017-06-29 2018-06-21 Application program packaging method and device and terminal device

Country Status (2)

Country Link
CN (1) CN107315593A (en)
WO (1) WO2019001335A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107315593A (en) * 2017-06-29 2017-11-03 广州优视网络科技有限公司 application program packaging method, device and terminal device
CN107908404A (en) * 2017-11-17 2018-04-13 深圳市泉眼网络科技有限公司 program packaging method, system and terminal device
CN109947493A (en) * 2017-12-19 2019-06-28 珠海市君天电子科技有限公司 Application program launching method, device, electronic equipment and storage medium
CN110554867B (en) * 2018-05-30 2023-03-28 阿里巴巴集团控股有限公司 Application processing method and device
CN111552518B (en) * 2019-01-24 2023-04-07 阿里巴巴集团控股有限公司 Method and device for loading control for starting application
CN110795143B (en) * 2019-10-22 2023-11-07 中国工商银行股份有限公司 Method, apparatus, computing device, and medium for processing functional modules
CN112929423A (en) * 2021-01-25 2021-06-08 上海契云科技有限公司 Method and device for data packaging of terminal equipment
CN112988287B (en) * 2021-03-15 2022-07-08 上海益世界信息技术集团有限公司广州分公司 Application program running method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150160939A1 (en) * 2013-12-05 2015-06-11 Kaspersky Lab Zao System and method for modifying a software distribution package without recalculating digital signatures
CN104866293A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending Android application program function
CN107315593A (en) * 2017-06-29 2017-11-03 广州优视网络科技有限公司 application program packaging method, device and terminal device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775842B (en) * 2016-11-30 2020-02-11 北京酷我科技有限公司 Customizable dex subpackaging method
CN106815301B (en) * 2016-12-12 2020-10-30 北京奇虎科技有限公司 Method and device for storing dex file

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150160939A1 (en) * 2013-12-05 2015-06-11 Kaspersky Lab Zao System and method for modifying a software distribution package without recalculating digital signatures
CN104866293A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending Android application program function
CN107315593A (en) * 2017-06-29 2017-11-03 广州优视网络科技有限公司 application program packaging method, device and terminal device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Recordation of Dex Package Dividing and Transformation", BUGLY OF TENCENT, 27 November 2015 (2015-11-27), pages 1 - 13, Retrieved from the Internet <URL:https://segmentfault.eom/a/1190000004053072> *
JIANSHUAI ET AL.: "Brief Introduction of DEX Automatically Unpacking and Dynamically Loading of Meituan Application", ANDROID, 15 June 2015 (2015-06-15), pages 1 - 11, Retrieved from the Internet <URL:https://tech.meituan.com/mt_android_auto_split_dex.html> *

Also Published As

Publication number Publication date
CN107315593A (en) 2017-11-03

Similar Documents

Publication Publication Date Title
WO2019001335A1 (en) Application program packaging method and device and terminal device
EP3531316B1 (en) Block chain-based data processing method and device
US20140344943A1 (en) System and method for securing sensitive data
US11210257B2 (en) Article, device, and techniques for serverless streaming message processing
US10095699B2 (en) Computer-readable recording medium, execution control method, and information processing apparatus
WO2016202000A1 (en) Differential rollback upgrading method and apparatus
TW201734780A (en) Mobile terminal application update method and device
US8195688B1 (en) Deconstruction and transformation of complex objects for de-duplicated storage
CN108279941A (en) A kind of compression method and device of application program
CN108228443B (en) Web application testing method and device
CN110795162B (en) Method and device for generating container mirror image file
US20170141922A1 (en) Incremental upgrade method and system for file
KR102141749B1 (en) APP program execution method and device
CN111427738B (en) Display method, application monitoring module, byte code enhancement module and display system
CN108959411B (en) Processing method, device and equipment of ETL (extract transform and load) task
CN112698842A (en) Method and device for acquiring additional information of application program
US8959088B2 (en) Log management method, log management system, and information processing apparatus
CN107092601B (en) Resource file construction method, resource file application method and device
WO2014206063A1 (en) Data exchange method and device
EP3309680B1 (en) Information processing device, information processing method, and information processing program
CN110399160B (en) Channel package packaging method, device, server and storage medium
CN113761005A (en) Metadata configuration method and device, electronic equipment and storage medium
CN110888686B (en) Application program starting method, device and storage medium
CN106776730B (en) Chinese compression and decompression method and device based on JAVA language
CN110134843B (en) Target file generation method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18824079

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18824079

Country of ref document: EP

Kind code of ref document: A1