CN111367510B - Android function module development method and device - Google Patents

Android function module development method and device Download PDF

Info

Publication number
CN111367510B
CN111367510B CN202010113359.5A CN202010113359A CN111367510B CN 111367510 B CN111367510 B CN 111367510B CN 202010113359 A CN202010113359 A CN 202010113359A CN 111367510 B CN111367510 B CN 111367510B
Authority
CN
China
Prior art keywords
functional module
module
target class
class file
functional
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
CN202010113359.5A
Other languages
Chinese (zh)
Other versions
CN111367510A (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.)
Tencent Music Entertainment Technology Shenzhen Co Ltd
Original Assignee
Tencent Music Entertainment Technology Shenzhen 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 Tencent Music Entertainment Technology Shenzhen Co Ltd filed Critical Tencent Music Entertainment Technology Shenzhen Co Ltd
Priority to CN202010113359.5A priority Critical patent/CN111367510B/en
Publication of CN111367510A publication Critical patent/CN111367510A/en
Application granted granted Critical
Publication of CN111367510B publication Critical patent/CN111367510B/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/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Abstract

The embodiment of the application discloses a method for developing an android functional module, which comprises the following steps: determining a first functional module and a second functional module which have a calling relation in a main project, wherein the calling relation is specifically that the first functional module calls a target class contained in the second functional module; migrating source codes of the first functional module from the main project to a pre-established module project; compiling the main project to obtain a compiled target class file corresponding to the target class; and uploading the target class file to a code management server for development and calling of the module engineering of the first functional module. By implementing the embodiment of the application, the independent development effect of the modules is achieved in the modularization transformation, and the modularization development efficiency is improved.

Description

Android function module development method and device
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for developing an android functional module.
Background
In the Android development process, due to the continuous growth of function services, source codes are more and more, engineering is huge, code coupling among different function services is serious easily, modification risks are large, and maintenance is difficult. Because codes of the modules corresponding to the functional services are maintained in the same project (namely, a main project), programmers of different modules can modify the codes at will; then responsible module a may rely on portions of module B that should not be relied upon, resulting in subsequent maintenance confusion between the individual module codes.
At present, aiming at the problem of code coupling, a modularized reconstruction scheme is generally adopted to solve the problem, namely, the scheme is divided according to functions, different functional modules in a main project are extracted one by one, and are placed into independent projects for development. Because the codes of different modules are respectively put into independent projects for maintenance, the problem of coupling can be relieved to a certain extent, and the maintainability of the projects is improved. However, the modular modification is a progressive process requiring the modules to be individually removed from the original main project. The modules are interdependent, and the time when different modules are pulled away from the main engineering is different. This may result in a module that may need to rely on functionality of a module that has not been removed from the main project during the removal process. For example, module a relies on the functionality of module B, which has not been pulled from the main project, but only suspends the development of module a; after the module B is extracted from the main project and released as a corresponding compressed file, the module A can continue the development work of the module A through the compressed file. The development work among the modules needs to be carried out in series, so that the development progress of one module can influence the normal operation of the development work of other modules, and the development efficiency of the whole modularized transformation is influenced.
Therefore, how to improve the overall modular development efficiency is a problem to be solved.
Disclosure of Invention
The embodiment of the application provides an ampere Zhuo Mokuai development method and device, which aim to achieve an independent development effect of modules in modularized transformation and improve the modularized development efficiency.
In a first aspect, embodiments of the present application provide an ampere Zhuo Mokuai development method, including:
determining a first functional module and a second functional module which have a calling relation in a main project, wherein the calling relation is specifically that the first functional module calls a target class contained in the second functional module;
migrating source codes of the first functional module from the main project to a pre-established module project;
compiling the main project to obtain a compiled target class file corresponding to the target class;
and uploading the target class file to a code management server for development and calling of the module engineering of the first functional module.
In the embodiment of the application, the first functional module in the main project is determined, and the calling relation exists between the first functional module and the second functional module of the main project. Compiling all the functional modules in the main engineering, including target classes in the first functional module; finding a target class file corresponding to the target class from class files obtained by compiling the main engineering; and when the target engineering corresponding to the second functional module develops or verifies the function, calling a target class file sent to the target engineering. By implementing the embodiment of the invention, the development of functions can be supported by relying on codes of the required modules under the condition that the dependent modules are not completely pulled out, and the related functions can be verified by independently running the current module, so that the development work of the current module cannot be influenced by the development progress of the other module, the independent development effect of the modules can be achieved in the modularization transformation, and the modularization development efficiency is improved.
In one possible implementation manner, the compiling the main project to obtain a compiled target class file corresponding to the target class includes:
adding annotation to the source code of the target class in the main project, wherein the annotation is used for marking the target class; compiling all the functional modules of the main project to obtain class files of all the functional modules, wherein byte code information of a classified file in the middle of the class files comprises the annotation; and determining the class file with the byte code information containing the annotation as a target class file corresponding to the target class.
In one possible implementation manner, the uploading the target class file to a code management server includes: copying the target class file from a first directory where the target class file is located to a second directory; and compressing the target class file under the second directory and then sending the compressed target class file to a code management server.
In one possible implementation, the module engineering of the first functional module is created on the code management server or other device connected to the code management server.
In one possible implementation, the method further includes: compiling module engineering of the first functional module to obtain a class file of the first functional module; removing the target class file from the class file of the first functional module to obtain the target class file of the first functional module; generating an installation package of the first functional module based on the target class file of the first functional module; the installation package is used for the verification device to perform operation verification on the first functional module.
In one possible implementation, the method further includes: after the verification of the first functional module is completed, compressing the target class file of the first functional module into a compressed package; transmitting the compressed packet to the code management server; and calling the compressed package from the code management server, and carrying out functional integration with the main engineering.
In a second aspect, embodiments of the present application provide an apparatus for developing a Zhuo Mokuai device, the apparatus comprising:
the determining unit is used for determining a first functional module and a second functional module which have a calling relation in the main engineering, wherein the calling relation is specifically that the first functional module calls a target class contained in the second functional module;
a migration unit, configured to migrate source codes of the first functional module from the main engineering to a module engineering created in advance;
the compiling unit is used for compiling the main engineering to obtain a compiled target class file corresponding to the target class;
and the calling unit is used for uploading the target class file to a code management server so as to enable the module engineering of the first functional module to be developed and called.
In a possible implementation manner, the compiling unit is specifically configured to: adding annotation to the source code of the target class in the main project, wherein the annotation is used for marking the target class; compiling all the functional modules of the main project to obtain class files of all the functional modules, wherein byte code information of a classified file in the middle of the class files comprises the annotation; and determining the class file with the byte code information containing the annotation as a target class file corresponding to the target class.
In a possible implementation manner, the calling unit is specifically configured to: copying the target class file from a first directory where the target class file is located to a second directory; and compressing the target class file under the second directory and then sending the compressed target class file to a code management server.
In one possible implementation, the module engineering of the first functional module is created on the code management server or other device connected to the code management server.
In a possible implementation manner, the apparatus further includes a verification unit, configured to: compiling module engineering of the first functional module to obtain a class file of the first functional module; removing the target class file from the class file of the first functional module to obtain the target class file of the first functional module; generating an installation package of the first functional module based on the target class file of the first functional module; the installation package is used for the verification device to perform operation verification on the first functional module.
In a possible implementation manner, the apparatus further includes a compression unit, configured to: after the verification of the first functional module is completed, compressing the target class file of the first functional module into a compressed package; transmitting the compressed packet to the code management server; and calling the compressed package from the code management server, and carrying out functional integration with the main engineering.
In a third aspect, an embodiment of the present application provides a terminal device, including a processor, a communication device, a memory, an input device, and an output device, where the processor, the communication device, the memory, the input device, and the output device are connected to each other, where the memory is configured to store application program code, and the processor is configured to invoke the application program code to perform a method according to any one of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any one of the first aspects above.
In a fifth aspect, embodiments of the present application provide a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of the first aspects above.
Drawings
The drawings that are used as needed in the embodiments of the present application will be described below.
FIG. 1 is a schematic diagram of an exemplary architecture for developing security Zhuo Mokuai provided in an embodiment of the present application;
Fig. 2 is a schematic flow chart of an ampere Zhuo Mokuai development method provided in an embodiment of the present application;
fig. 3 is a flow chart of another android module development method according to an embodiment of the present application;
fig. 4 is a schematic diagram of an application scenario developed by an ampere Zhuo Mokuai provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for developing an ampere Zhuo Mokuai according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
The following will describe in detail.
First, some terms in this application are explained for easy understanding by those skilled in the art.
(1) Android (Android), which is an open source code mobile operating system based on a Linux kernel, is one of the currently mainstream mobile phone operating systems; the Android development in the embodiment of the application refers to application development based on an Android system.
(2) A module, which refers to a part of a complex system (whole), may be understood as a single functional module. The modularization is a mode of decomposing a complex system into manageable modules, and in the field of software development, a certain service (function) is divided into independent parts for development and maintenance.
(3) The Android archive (Android Archive Library, AAR) is a package form of source codes, resource files and the like in Android, and is a compressed file in a zip format.
(4) Maven refers to a dependency management system responsible for version management of AAR. As it is typically built in a remote server, it may also be referred to as a Maven server.
(5) Plug-in technology is a dynamic technology based on an Android system, and is a technology for dynamically loading and executing certain codes (plug-ins) without independently installing other application packages (Android application package, android) or upgrading the current apk on the basis that a user installs an application.
(6) Classes (classes), which in object-oriented programming are constructs of an object-oriented computer programming language, are blueprints of created objects, describing properties and methods common to the created objects. A more stringent definition of a class is a cohesive package consisting of some specific metadata. It describes the behavior rules of objects, which are called instances of this class. Classes have interfaces and structures. The interface describes how to interoperate with classes and their instances by means of methods, while the structure describes how data is divided into multiple attributes in one instance. Whereas class files are a set of binary streams in units of 8-bit bytes.
A system architecture developed by an ampere Zhuo Mokuai provided in an embodiment of the present application is described below. Referring to fig. 1, fig. 1 is a schematic diagram of an architecture for developing an security Zhuo Mokuai according to an embodiment of the present application, which includes a terminal 1 (a computer is exemplified in fig. 1), a server (a maven server is exemplified in fig. 1), and a terminal 2 (a smart phone is exemplified in fig. 1). Wherein,
and the computer stores all the active codes of the main project and is used for writing, modifying and other operations on the codes. And (5) carrying out module division on the code of the main project, and marking the target class code. For example, a class (i.e., code) called by module a is found in module B, the code is marked, and so on. In the embodiment of the present application, the terminal 1 is exemplified by a computer, but the terminal for operating the code is not limited to the computer.
And the server is used for storing codes of other modules depending on the certain module. For example, after the target class code is determined, the target class code is sent to a maven server. The object class code is invoked from the server when the module is developed or validated.
The intelligent mobile phone is used for receiving the compressed package and the resource file corresponding to the main project; and verifies the function of module a in a plug-in framework when verifying the function of the module. For example, after the compressed package corresponding to the developed module a is sent to the terminal, the terminal decompresses the compressed package under the directory of the application program to obtain the dex file of the module a and the resource file related to the module a. The entry function of module a is then back-invoked, running to verify the function of module a.
It is understood that the illustration of fig. 1 is merely an exemplary implementation in the examples of the present application. The system architecture in the embodiments of the present application may include, but is not limited to, the above system architecture.
The technical problems set forth in the present application are specifically analyzed and solved in the following in combination with the system architecture and the embodiments of the android module development method provided in the present application.
Referring to fig. 2, fig. 2 is a schematic diagram of a development method of an embodiment Zhuo Mokuai of the present application, which can be applied to the system architecture of fig. 1, and is described below with reference to fig. 2 from a single side of a computer. The method may include the following step S201-step S204.
Step S201: and determining a first functional module and a second functional module which have calling relations in the main engineering.
Specifically, the first functional module is determined in the module code of the main engineering according to the characteristics of the first functional module. The feature of the first functional module may include the first functional module invoking the target class included in the second functional module; for example, module B is determined to be the first functional module based on the reference of part of the code in module a by module B. The main project comprises a first functional module and a second functional module, and the first functional module and the second functional module have a calling relationship. The calling relation is specifically that the first functional module calls a target class contained in the second functional module.
In one possible implementation, determining one or more identical class names in the first functional module and the second functional module; and determining the one or more target classes in the first functional module according to the one or more identical class names. For example, the module a (i.e., the first functional module) and the module B (i.e., the second functional module) have the same class name, and it is determined to which module the class name originally belongs. And determining the corresponding class as a target class according to the class name.
Step S202: and migrating the source code of the first functional module from the main project to a pre-created module project.
Specifically, after the source code of the first functional module is obtained, the source code of the first functional module is copied to one copy, and the copied source code of the first functional module is migrated to a pre-created module project.
Step S203: and compiling the main engineering to obtain a compiled target class file corresponding to the target class.
Specifically, all the functional modules in the main engineering are compiled, and codes (i.e. classes) in the functional modules are compiled into class files (i.e. class files). For example, the code file format of the main project is java file, and the java file is changed into a class file through compiling. Class files are the products of compiling the code after the main project. The target class is called by the first functional module and belongs to the class of the second functional module. And compiling the main project to obtain a target class file corresponding to the target class.
In one possible implementation manner, the compiling the main project to obtain a compiled target class file corresponding to the target class includes: adding annotation to the source code of the target class in the main project, wherein the annotation is used for marking the target class; compiling all the functional modules of the main project to obtain class files of all the functional modules, wherein byte code information of a classified file in the middle of the class files comprises the annotation; and determining the class file with the byte code information containing the annotation as a target class file corresponding to the target class. For example, each line of code in the source code of the target class adds annotations. Compiling all the functional modules in the main engineering to obtain class files of the corresponding functional modules; each class file has corresponding byte code information; the annotation content of the code can be checked in the byte code information; the class file containing the annotation is determined to be the target class file.
Optionally, adding annotations to the one or more target classes, the annotations for marking the one or more target classes; compiling all functional modules of the main project to obtain one or more class files, wherein byte code information of a classified file in the middle of the one or more class files comprises the annotation; and determining the partial class file as a target class file corresponding to the one or more target classes according to the byte code information of the partial class file. For example, determining one or more target class files containing annotations from a plurality of class files, wherein the plurality of class files are class files obtained by compiling a main project; the second class file is a class file obtained by compiling the target class containing the annotation in the main engineering; the first functional module and the second functional module are different functional modules of the main engineering. The annotation can be determined from the byte code information of the class file, and the target class file corresponding to the target class can be determined according to the class file containing the annotation.
Step S204: and uploading the target class file to a code management server for development and calling of the module engineering of the first functional module.
Specifically, after the target class file is determined, the target class file is transmitted to the code management server. For example, after the first functional module is pulled away from the main project, the first functional module becomes an independent project to edit and develop, and may be on other servers or terminals. The independent engineering corresponding to the first functional module can call the target class file in the code management server to develop and perfect the function.
Optionally, copying the target class file from the first directory where the target class file is located to a second directory; and compressing the target class file under the second directory and then sending the compressed target class file to a code management server. For example, the target class file is in a directory A, the copied target class file is copied to a paper directory B, wherein the directory A and the directory B can be in the same server or terminal; or catalog a and catalog B are on different servers or terminals. Compressing the target class file under the catalog B (the embodiment of the invention does not limit the specific compression form), and sending the compressed target class file under the catalog B to the code management server. When the first functional module needs to call the target class file, the code management server stores and manages the compressed target class file, and the corresponding compressed package (including the compressed target class file) can be downloaded from the code management server, and then the compressed package or the corresponding target class file is decompressed.
In one possible implementation manner, the target class file is copied from a first directory where the target class file is located to a second directory; compressing the target class file under the second directory and then sending the compressed target class file to a first server; the target project is stored in the first server. For example, after the target class file is determined by the computer storing the main project, the determined target class file is copied to the second directory, i.e. the target class file is copied from the original directory to a new directory, such as a ProvideAPI directory. All class files under the directory are compressed and packaged into module-app.aar, and then uploaded to the corresponding server.
Further alternatively, the module engineering of the first functional module is created on the code management server or other device connected to the code management server. When the module engineering of the first functional module is created on the code management server, the compressed package corresponding to the target class file is directly obtained from the code management server so as to realize the call to the target class file. When the module engineering of the first functional module is created in other equipment (such as a terminal or other servers) connected with the code management server, the module engineering sends a calling instruction to the other equipment through the code management server, and after the calling instruction is received, identified and verified by the other equipment, the module engineering sends a compressed package containing the target class file to the code management server.
Referring to fig. 3, fig. 3 is a schematic diagram of a development method of an embodiment of an ampere Zhuo Mokuai, which can be applied to the system architecture of fig. 1, and is described below with reference to fig. 3 from a single side of a computer. The method may comprise the following steps S301-S307, optional steps comprising step S305, step S306 and step S307.
Step S301: and determining a first functional module and a second functional module which have calling relations in the main engineering.
Specifically, please refer to the aforementioned step S201.
Step S302: and migrating the source code of the first functional module from the main project to a pre-created module project.
Specifically, please refer to step S202.
Step S303: and compiling the main engineering to obtain a compiled target class file corresponding to the target class.
Specifically, please refer to the aforementioned step S203.
Step S304: and uploading the target class file to a code management server for development and calling of the module engineering of the first functional module.
Specifically, see step S204; one or more target class files under the first directory are copied to a second directory (e.g., a ProvideAPI directory). Optionally, after compressing the target class file, the target class file is sent to a code management server. For example, the target class files under the relevant directory (e.g., provideAPI directory) are compressed and packaged into aar format and sent to a code management server (e.g., maven server).
Step S305: and when a first project corresponding to the first functional module is operated, the target class file is sent to a first server where the first project is located through the code management server.
Specifically, when the first project needs to call the target class file, the code management server (taking a maven server as an example) sends the compressed package of the compressed and packaged target class file to the first server where the first project is located. When a second project corresponding to the second functional module is operated, the second project calls the target class file in the server through the own entry function or other modes, and development of the own function is continued. And sending the first engineering call corresponding to the first functional module to the target class file.
Step S306: compiling the first project to obtain a plurality of class files belonging to the first project.
Specifically, after the function development of the target engineering is completed, compiling the target engineering to obtain a plurality of class files belonging to the first engineering. Wherein the plurality of class files belonging to the first project comprise the target class file.
Step S307: and removing the target class file from a plurality of class files belonging to the first project when the first project and the main project are functionally integrated.
Specifically, before the dex process is performed on the third class file corresponding to the first project, all class files that need to participate in the dex process are filtered, and the class files from the module-app.aar (i.e., the referenced target class files) are removed.
In one possible implementation manner, compiling a module project of the first functional module to obtain a class file of the first functional module; removing the target class file from the class file of the first functional module to obtain the target class file of the first functional module; and generating an installation package of the first functional module based on the target class file of the first functional module.
For example, the module engineering of the first functional module obtains a class file corresponding to the first functional module through compiling, wherein the class file can contain a target class file of the called second functional module; when the main engineering installation package is generated, the target class file from the second functional module needs to be removed, and the code cannot be redundant and repeated by removing the target class file of the second functional module because the main engineering comprises the first functional module and the second functional module. Or when the module A needs to run and verify the self function, locating an entry function (the function of the module A can be run after the entry function is called) disclosed in the self code; after triggering the compiling of the module engineering A, compiling all source codes in the engineering into class files; before the dex flow is performed, all the class files that need to participate in the dex are filtered, and class files from module-app.aar are removed. The installation package is used for the verification device to perform operation verification on the first functional module. For example, pushing module-A.apk to a module directory of the mobile phone SD card directory; decompressing the module-A.apk to an application built-in directory when the main project is started to obtain a dex file and a resource file of the module A; the main project loads the dex file and the resource file of the module A in a plug-in mode; the main engineering reflection calls the entry function of the module A, calls the function of the module A, and verifies whether the realization of the module A is correct.
Optionally, after removing a part of the class files corresponding to the first functional module, checking the remaining class files corresponding to the first functional module to check the accuracy of the code. Further optionally, after the verification of the first functional module is completed, compressing the target class file of the first functional module into a compressed package; transmitting the compressed packet to the code management server; and calling the compressed package from the code management server, and carrying out functional integration with the main engineering. For example, in the process of integration, the main project acquires the required corresponding compressed package from the module project corresponding to each functional module; and decompressing the compressed package, integrating the class files therein, and finally generating an installation package of the application.
Next, an application scenario of data protection provided in the present application is described. Referring to fig. 4, fig. 4 is a schematic diagram of an application scenario developed by an ampere Zhuo Mokuai according to an embodiment of the present application. The architecture developed by the android module can be applied in the scenario shown in fig. 4. As shown in fig. 4, wherein the main project is a project before modular modification; the main engineering contains a plurality of modules (such as codes of a first functional module (namely a module B) and a second functional module (namely a module A)) inside;
Firstly, when a module A needs to be extracted from a main project and is independently formed into a module, a module project A is newly established, wherein the module A comprises a lib file and an app file; migrating the code logic of the module A from the main project to the module project A, and developing self module logic; when the module A needs to rely on the function of the module B, but the module B is not yet extracted from the main engineering, the following steps are carried out:
1. finding the class which belongs to the module B and needs to be called by the module A in the main engineering, and adding an @ API annotation;
2. triggering the main engineering compiling, and compiling all source codes into class files through a java tool; optionally, the resource file is generated by aapt. Packaging the residual dex file and resource file of the main project into module-app.apk; to the terminal (application). Further alternatively, the plug-in framework is started when the handset runs the program, running the apk (i.e. module-a.apk) of the subsequently received module a.
3. Traversing all generated class files, analyzing byte code information of the class files, and copying the class files to a ProviddPI directory if the class files contain @ API comments;
4. packaging all class files under the ProviddPI directory into module-app.aar, and uploading to a Maven server;
5. The module A refers to module-app.aar, invokes the class therein, and continues the development of the self function. Optionally, when the function of the module A is developed, a resource file is obtained through an aapt tool, and a class file corresponding to the project is obtained through java.
Next, when the module a needs to run the authentication self function, the following steps may be performed: 1. module a provides a published entry function that, when called, can run the functions of module a; 2. triggering compiling of the module engineering A; 3. all source codes in the engineering are compiled into class files, all class files needing to participate in the dex are filtered before the dex flow is carried out, and class files from module-app.aar are removed.
After the dex flow is finished, the output dex file and the resource file are packaged into a module-A.apk; pushing the module-A.apk to a module directory of the mobile phone SD card directory; restarting the main project, and decompressing the module-A.apk to an application built-in directory when the main project is started to obtain a dex file and a resource file of the module A; the main project loads the dex file and the resource file of the module A in a plug-in manner; the main engineering reflects and calls the entry function of the module A, calls the function of the module A, and a developer starts to verify whether the realization of the module A is correct; after the development and verification of the module A are completed, packaging and publishing the module A as module-A.aar, and uploading the module A to a Maven server; the main engineering refers to module-A.aar, completes function integration, and packages and publishes the final APK.
It can be appreciated that the application scenario in fig. 4 is only an exemplary implementation of the embodiment of the present invention, and the application scenario in the embodiment of the present invention includes, but is not limited to, the above application scenario.
In order to facilitate better implementation of the above-mentioned scheme of the present application, the embodiment of the present application correspondingly provides an apparatus for developing an ampere Zhuo Mokuai, please refer to fig. 5, fig. 5 is a schematic structural diagram of an apparatus for developing an ampere Zhuo Mokuai provided in the embodiment of the present application; the following is a detailed description with reference to fig. 5:
as shown in fig. 5, the android module development apparatus 50 may include a determination unit 501, a migration unit 502, a compiling unit 503, a calling unit 504, a verification unit 505, and a compression unit 506; optional units include a verification unit 505 and a compression unit 506; wherein,
a determining unit 501, configured to determine a first functional module and a second functional module that have a calling relationship in a main project, where the calling relationship is specifically that the first functional module calls a target class included in the second functional module;
a migration unit 502, configured to migrate source codes of the first functional module from the main engineering to a pre-created module engineering;
A compiling unit 503, configured to compile the main project to obtain a compiled target class file corresponding to the target class; the method comprises the steps of carrying out a first treatment on the surface of the
And a calling unit 504, configured to upload the target class file to a code management server, so that development and calling are performed on the module engineering of the first functional module.
In a possible implementation manner, the compiling unit 503 is specifically configured to: adding annotation to the source code of the target class in the main project, wherein the annotation is used for marking the target class; compiling all the functional modules of the main project to obtain class files of all the functional modules, wherein byte code information of a classified file in the middle of the class files comprises the annotation; and determining the class file with the byte code information containing the annotation as a target class file corresponding to the target class.
In one possible implementation manner, the calling unit 504 is specifically configured to: copying the target class file from a first directory where the target class file is located to a second directory; and compressing the target class file under the second directory and then sending the compressed target class file to a code management server.
In one possible implementation, the module engineering of the first functional module is created on the code management server or other device connected to the code management server.
In a possible implementation manner, the apparatus further includes a verification unit 505, configured to: compiling module engineering of the first functional module to obtain a class file of the first functional module; removing the target class file from the class file of the first functional module to obtain the target class file of the first functional module; generating an installation package of the first functional module based on the target class file of the first functional module; the installation package is used for the verification device to perform operation verification on the first functional module.
In a possible implementation, the apparatus further includes a compression unit 506 configured to: after the verification of the first functional module is completed, compressing the target class file of the first functional module into a compressed package; transmitting the compressed packet to the code management server; and calling the compressed package from the code management server, and carrying out functional integration with the main engineering.
It should be noted that, the specific implementation and the beneficial effects of each unit in the android module development device 50 shown in fig. 5 may correspond to corresponding descriptions in the method embodiments shown in fig. 2-3, and are not repeated herein.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present application; the terminal device 60 comprises a processor 601, a memory 602, a communication interface 603, an input means 606 and an output means 606, said processor 601, memory 602, communication interface 603, input means 606 and output means 606 being interconnected by a bus 604. The terminal device 60 may be a terminal device such as a tablet computer or a personal computer, the input device 606 may be a device such as a keyboard, a mouse, a voice input, a touch panel, and the output device may be a device such as a display.
Memory 602 includes, but is not limited to, random access memory (random access memory, RAM), read-only memory (ROM), erasable programmable read-only memory (erasable programmable read only memory, EPROM), or portable read-only memory (compact disc read-only memory, CD-ROM), and memory 602 is used for storage of related instructions and data. The communication interface 603 is used to receive and transmit data.
The processor 601 may be one or more central processing units (central processing unit, CPU), and in the case where the processor 601 is one CPU, the CPU may be a single-core CPU or a multi-core CPU.
The processor 601 in the terminal device 60 is configured to read the program code stored in the memory 602, and perform the following operations:
the processor 601 is configured to determine a first functional module and a second functional module that have a calling relationship in a main project, where the calling relationship is specifically that the first functional module calls a target class included in the second functional module; migrating source codes of the first functional module from the main project to a pre-established module project; compiling the main project to obtain a compiled target class file corresponding to the target class; and uploading the target class file to a code management server for development and calling of the module engineering of the first functional module.
In one possible implementation, the processor 601 is configured to: adding annotation to the source code of the target class in the main project, wherein the annotation is used for marking the target class; compiling all the functional modules of the main project to obtain class files of all the functional modules, wherein byte code information of a classified file in the middle of the class files comprises the annotation; and determining the class file with the byte code information containing the annotation as a target class file corresponding to the target class.
In one possible implementation, the processor 601 is configured to: copying the target class file from a first directory where the target class file is located to a second directory; and compressing the target class file under the second directory and then sending the compressed target class file to a code management server. Optionally, the module engineering of the first functional module is created on the code management server or other device connected to the code management server.
In one possible implementation, the processor 601 is configured to: compiling module engineering of the first functional module to obtain a class file of the first functional module; removing the target class file from the class file of the first functional module to obtain the target class file of the first functional module; generating an installation package of the first functional module based on the target class file of the first functional module; the installation package is used for the verification device to perform operation verification on the first functional module.
In one possible implementation, the processor 601 is configured to: after the verification of the first functional module is completed, compressing the target class file of the first functional module into a compressed package; transmitting the compressed packet to the code management server; and calling the compressed package from the code management server, and carrying out functional integration with the main engineering.
In the embodiment of the application, the target class in the main engineering is determined, and the target class is the class of the first functional module and has a calling relationship with the second functional module of the main engineering. Compiling all the functional modules in the main engineering, including target classes in the first functional module; finding a target class file corresponding to the target class from class files obtained by compiling the main engineering; and when the target engineering corresponding to the second functional module develops or verifies the function, calling a target class file sent to the target engineering. By implementing the embodiment of the invention, the development of functions can be supported by relying on codes of the required modules under the condition that the dependent modules are not completely pulled out, and the related functions can be verified by independently running the current module, so that the development work of the current module cannot be influenced by the development progress of the other module, the independent development effect of the modules can be achieved in the modularization transformation, and the modularization development efficiency is improved.
It should be noted that the implementation and beneficial effects of the above operations may also correspond to the corresponding descriptions of the method embodiments shown in fig. 2-4.
Embodiments of the present application also provide a computer readable storage medium storing a computer program comprising program instructions that, when executed by a processor, implement the method flows shown in fig. 2-4.
Embodiments of the present application also provide a computer program comprising program instructions which, when executed by a processor, implement the method flows shown in fig. 2-4.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.

Claims (6)

1. The method for developing the android functional module is characterized by comprising the following steps of:
determining a first functional module and a second functional module which have a calling relation in a main project, wherein the calling relation is specifically that the first functional module calls a target class contained in the second functional module, and the second functional module is positioned in the main project;
migrating source codes of the first functional module from the main project to a pre-established module project;
compiling all functional modules of the main project to obtain compiled target class files corresponding to the target classes;
copying the target class file from a first directory where the target class file is located to a second directory;
After compressing the target class file under the second catalog, uploading the target class file to a code management server for development and calling of the module engineering of the first functional module;
compiling module engineering of the first functional module to obtain a class file of the first functional module;
removing the target class file from the class file of the first functional module to obtain the target class file of the first functional module;
generating an installation package of the first functional module based on the target class file of the first functional module; the installation package is used for the verification equipment to perform operation verification on the first functional module;
after the verification of the first functional module is completed, compressing the target class file of the first functional module into a compressed package;
transmitting the compressed packet to the code management server;
and calling the compressed package from the code management server, and carrying out functional integration with the main engineering.
2. The method according to claim 1, wherein compiling all functional modules of the main project to obtain compiled object class files corresponding to the object classes includes:
adding annotation to the source code of the target class in the main project, wherein the annotation is used for marking the target class;
Compiling all the functional modules of the main project to obtain class files of all the functional modules, wherein byte code information of a classified file in the middle of the class files comprises the annotation;
and determining the class file with the byte code information containing the annotation as a target class file corresponding to the target class.
3. The method of claim 1, wherein the module engineering of the first functional module is created on the code management server or other device connected to the code management server.
4. An apparatus for android functional module development, comprising:
the determining unit is used for determining a first functional module and a second functional module which have a calling relation in a main project, wherein the calling relation is specifically that the first functional module calls a target class contained in the second functional module, and the second functional module is located in the main project;
a migration unit, configured to migrate source codes of the first functional module from the main engineering to a module engineering created in advance;
the compiling unit is used for compiling all the functional modules of the main project to obtain compiled target class files corresponding to the target classes;
The calling unit is used for copying the target class file from the first directory where the target class file is located to the second directory; after compressing the target class file under the second catalog, uploading the target class file to a code management server for development and calling of the module engineering of the first functional module;
the verification unit is used for compiling the module engineering of the first functional module to obtain a class file of the first functional module; removing the target class file from the class file of the first functional module to obtain the target class file of the first functional module; generating an installation package of the first functional module based on the target class file of the first functional module; the installation package is used for the verification equipment to perform operation verification on the first functional module;
the compression unit is used for compressing the target class file of the first functional module into a compression packet after the verification of the first functional module is completed; transmitting the compressed packet to the code management server; and calling the compressed package from the code management server, and carrying out functional integration with the main engineering.
5. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1-3.
6. A computer program product comprising a computer program comprising instructions which, when executed by a computer, cause the computer to perform the method of any of claims 1-3.
CN202010113359.5A 2020-02-24 2020-02-24 Android function module development method and device Active CN111367510B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010113359.5A CN111367510B (en) 2020-02-24 2020-02-24 Android function module development method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010113359.5A CN111367510B (en) 2020-02-24 2020-02-24 Android function module development method and device

Publications (2)

Publication Number Publication Date
CN111367510A CN111367510A (en) 2020-07-03
CN111367510B true CN111367510B (en) 2024-03-19

Family

ID=71208173

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010113359.5A Active CN111367510B (en) 2020-02-24 2020-02-24 Android function module development method and device

Country Status (1)

Country Link
CN (1) CN111367510B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112015394B (en) * 2020-08-27 2024-02-27 北京百度网讯科技有限公司 Android function module development method and device, computer system and storage medium
CN112083930A (en) * 2020-09-14 2020-12-15 华帝股份有限公司 Optimization method for android project compiling process
CN112527306A (en) * 2020-10-27 2021-03-19 百果园技术(新加坡)有限公司 Method, device, equipment and medium for realizing independence of modules in project development
CN112346778B (en) * 2020-10-28 2022-02-08 常州微亿智造科技有限公司 Optimization method for automatically generating byte codes during compiling of Java program
CN112286533B (en) * 2020-11-16 2024-01-26 广州速威智能系统科技有限公司 Thermal restoration method and device for cloud service
CN112631622A (en) * 2020-12-29 2021-04-09 Oppo广东移动通信有限公司 Application installation method and device, server and computer readable medium
CN113434219B (en) * 2021-07-08 2024-03-26 展讯通信(天津)有限公司 Information configuration method and equipment for engineering project
CN115981614B (en) * 2023-02-24 2023-07-07 美云智数科技有限公司 Modular processing method for project engineering, electronic equipment and computer storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107357593A (en) * 2017-08-24 2017-11-17 武汉斗鱼网络科技有限公司 Source code file construction method, device, electric terminal and readable storage medium storing program for executing
CN107885527A (en) * 2016-09-27 2018-04-06 北京嘀嘀无限科技发展有限公司 A kind of code revision method and device of test system
CN107908403A (en) * 2017-11-10 2018-04-13 北京搜狐新动力信息技术有限公司 A kind of collocation method and system of the modularization of mobile terminal business module
CN109032815A (en) * 2018-07-18 2018-12-18 武汉斗鱼网络科技有限公司 Information interacting method, device, equipment and storage medium between functional module
CN109144525A (en) * 2017-06-26 2019-01-04 研祥智能科技股份有限公司 A kind of software installation method and system of network self-adapting
CN109445807A (en) * 2017-08-28 2019-03-08 腾讯科技(深圳)有限公司 Realize the method, apparatus and computer readable storage medium of application program update
CN109542445A (en) * 2017-08-01 2019-03-29 北京京东尚科信息技术有限公司 A kind of method and apparatus that Android plug-in unit melts hair
US10324712B1 (en) * 2014-12-24 2019-06-18 Thomas A. Nolan Method and system of migrating legacy code for upgraded systems
CN110058850A (en) * 2019-04-10 2019-07-26 腾讯音乐娱乐科技(深圳)有限公司 A kind of development approach of application, device and storage medium
CN110231945A (en) * 2019-05-20 2019-09-13 深圳壹账通智能科技有限公司 Method, apparatus, electronic equipment and the computer storage medium of code downloading
CN110333868A (en) * 2019-06-12 2019-10-15 阿里巴巴集团控股有限公司 For generating the method and system of the installation kit of sub- application
US10521613B1 (en) * 2018-08-08 2019-12-31 Carlos Manuel Gonzalez Adaptive standalone secure software
CN110737437A (en) * 2018-07-20 2020-01-31 北京君正集成电路股份有限公司 compiling method and device based on code integration

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009238040A (en) * 2008-03-27 2009-10-15 Hitachi Ltd Support method, support program, and support system for inter-module cooperation

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10324712B1 (en) * 2014-12-24 2019-06-18 Thomas A. Nolan Method and system of migrating legacy code for upgraded systems
CN107885527A (en) * 2016-09-27 2018-04-06 北京嘀嘀无限科技发展有限公司 A kind of code revision method and device of test system
CN109144525A (en) * 2017-06-26 2019-01-04 研祥智能科技股份有限公司 A kind of software installation method and system of network self-adapting
CN109542445A (en) * 2017-08-01 2019-03-29 北京京东尚科信息技术有限公司 A kind of method and apparatus that Android plug-in unit melts hair
CN107357593A (en) * 2017-08-24 2017-11-17 武汉斗鱼网络科技有限公司 Source code file construction method, device, electric terminal and readable storage medium storing program for executing
CN109445807A (en) * 2017-08-28 2019-03-08 腾讯科技(深圳)有限公司 Realize the method, apparatus and computer readable storage medium of application program update
CN107908403A (en) * 2017-11-10 2018-04-13 北京搜狐新动力信息技术有限公司 A kind of collocation method and system of the modularization of mobile terminal business module
CN109032815A (en) * 2018-07-18 2018-12-18 武汉斗鱼网络科技有限公司 Information interacting method, device, equipment and storage medium between functional module
CN110737437A (en) * 2018-07-20 2020-01-31 北京君正集成电路股份有限公司 compiling method and device based on code integration
US10521613B1 (en) * 2018-08-08 2019-12-31 Carlos Manuel Gonzalez Adaptive standalone secure software
CN110058850A (en) * 2019-04-10 2019-07-26 腾讯音乐娱乐科技(深圳)有限公司 A kind of development approach of application, device and storage medium
CN110231945A (en) * 2019-05-20 2019-09-13 深圳壹账通智能科技有限公司 Method, apparatus, electronic equipment and the computer storage medium of code downloading
CN110333868A (en) * 2019-06-12 2019-10-15 阿里巴巴集团控股有限公司 For generating the method and system of the installation kit of sub- application

Also Published As

Publication number Publication date
CN111367510A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
CN111367510B (en) Android function module development method and device
US6083279A (en) Platform independent technique for transferring software programs over a network
US8756616B2 (en) System and method for reducing the static footprint of mixed-language JAVA classes
US20210232388A1 (en) Software pipeline configuration
CN110059456B (en) Code protection method, code protection device, storage medium and electronic equipment
CN112433747B (en) Differential upgrading method and system suitable for Software Development Kit (SDK)
CN111399840B (en) Module development method and device
CN112835975B (en) Method for deploying, updating and calling intelligent contracts in blockchain
CN111026439A (en) Application program compatibility method, device, equipment and computer storage medium
CN113741954A (en) System software generation method and device, electronic equipment and storage medium
EP3797356A1 (en) Code base sharing between standalone and web-based versions of an application via an emulated network communication channel
CN111352631B (en) Interface compatibility detection method and device
CN114546581A (en) Service-free container starting method and related equipment
CN110806891B (en) Method and device for generating software version of embedded device
CN112000334A (en) Page development method, device, server and storage medium
CN111258802A (en) Method for capturing application program crash information and related equipment
CN112328241B (en) Method and device for creating Android library module dependency relationship in application program development
CN111752548A (en) SDK embedding method and device and computer readable storage medium
CN108345461B (en) Application updating method and device and computer readable storage medium
CN115543486B (en) Server-free computing oriented cold start delay optimization method, device and equipment
CN113467803B (en) Application program repairing method, related device and equipment
CN117093286B (en) Plug-in generation method, device, equipment and computer readable storage medium
CN113590166B (en) Application program updating method and device and computer readable storage medium
CN117056317B (en) Data processing method, device, equipment and computer readable storage medium
CN115934123A (en) Client logic updating method and 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
GR01 Patent grant
GR01 Patent grant