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

Android function module development method and device Download PDF

Info

Publication number
CN111367510A
CN111367510A CN202010113359.5A CN202010113359A CN111367510A CN 111367510 A CN111367510 A CN 111367510A CN 202010113359 A CN202010113359 A CN 202010113359A CN 111367510 A CN111367510 A CN 111367510A
Authority
CN
China
Prior art keywords
module
functional module
target class
class file
project
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.)
Granted
Application number
CN202010113359.5A
Other languages
Chinese (zh)
Other versions
CN111367510B (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

Images

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

Landscapes

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

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 relationship in a main project, wherein the calling relationship is a target class included in the second functional module called by the first functional module; migrating the source code 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 project of the first functional module. Through implementing this application embodiment, reach the independent development effect of module in the modularization transformation, improved modularization development efficiency.

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 functional services, more and more source codes and increasingly huge engineering, code coupling among different functional services is severe, the change risk is large, and the maintenance is difficult. Because the 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 what should not be relied upon in module B, resulting in a subsequent maintenance confusion between the various module codes.
At present, the problem of code coupling is generally solved by adopting a scheme of modular transformation, namely, the code is divided according to functions, different functional modules in a main project are extracted one by one and placed in an independent project for development. Because the codes of different modules are respectively put into independent projects for maintenance, the problem of coupling can be reduced to a certain extent, and the maintainability of the projects is improved. However, the modular transformation is a progressive process, and the modules need to be extracted one by one from the original main project. The modules are interdependent, and the time of drawing different modules from the main project is different. This may result in that a module may need to rely on the function of a module that has not been pulled away from the main project during the pulling process. For example, module a relies on the functionality of module B, which has not been pulled away from the main project, and then only module a development can be suspended; when the module B is extracted from the main project and is 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 a certain module can influence the normal 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 an urgent problem to be solved.
Disclosure of Invention
The embodiment of the application provides an android module development method and device, and aims to achieve the effect of independent module development in modularization transformation and improve the modularization development efficiency.
In a first aspect, an embodiment of the present application provides an android module development method, where the method includes:
determining a first functional module and a second functional module which have a calling relationship in a main project, wherein the calling relationship is a target class included in the second functional module called by the first functional module;
migrating the source code 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 project of the first functional module.
In the embodiment of the application, a calling relation exists between the first function module in the main project and the second function module in the main project. Compiling all functional modules in the main project, including the target class in the first functional module; finding a target class file corresponding to the target class from class files obtained by compiling the main project; and calling the target class file sent to the target project when the target project corresponding to the second functional module is developed or verified. By implementing the embodiment of the invention, the function development of a certain module depending on the code of the required module can be supported under the condition that the module depending on the module is not taken out and finished, and the related functions can be independently verified by running the current module, so that the development work of the current module cannot be influenced by the development progress of another module, the independent module development effect can be achieved in the modularization transformation, and the modularization development efficiency is improved.
In a possible implementation manner, the compiling the main project to obtain a compiled target class file corresponding to the target class includes:
adding an 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 functional modules of the main project to obtain class files of all functional modules, wherein byte code information of middle classification files of the class files comprises the annotations; and determining the class file of which the bytecode information contains 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 to a second directory from a first directory where the target class file is located; and compressing the target class file in 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 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 a 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; and the installation package is used for verifying the operation of the first functional module by the verifying equipment.
In one possible implementation, the method further includes: after the verification of the first functional module is finished, compressing the target class file of the first functional module into a compressed packet; sending the compressed packet to the code management server; and calling the compressed packet from the code management server to perform function integration with the main project.
In a second aspect, an embodiment of the present application provides an android module development device, where the device includes:
the system comprises a determining unit and a processing unit, wherein the determining unit is used for determining a first functional module and a second functional module which have a calling relationship in a main project, and the calling relationship is specifically a target class contained in the second functional module called by the first functional module;
a migration unit, configured to migrate the source code of the first functional module from the main project to a module project created in advance;
the compiling unit is used for compiling the main project 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 develop and call the module engineering of the first functional module.
In a possible implementation manner, the compiling unit is specifically configured to: adding an 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 functional modules of the main project to obtain class files of all functional modules, wherein byte code information of middle classification files of the class files comprises the annotations; and determining the class file of which the bytecode information contains the annotation as a target class file corresponding to the target class.
In a possible implementation manner, the invoking unit is specifically configured to: copying the target class file to a second directory from a first directory where the target class file is located; and compressing the target class file in 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 checking unit, configured to: 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 a 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; and the installation package is used for verifying the operation of the first functional module by the verifying equipment.
In a possible implementation, the apparatus further includes a compression unit configured to: after the verification of the first functional module is finished, compressing the target class file of the first functional module into a compressed packet; sending the compressed packet to the code management server; and calling the compressed packet from the code management server to perform function integration with the main project.
In a third aspect, an embodiment of the present application provides a terminal device, including a processor, a communication device, a memory, an input apparatus, and an output apparatus, where the processor, the communication device, the memory, the input apparatus, and the output apparatus are connected to each other, where the memory is used to store an application program code, and the processor is configured to call the application program code to perform the method according to any one of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, the computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method of any one of the above first aspects.
In a fifth aspect, the present application provides a computer program comprising program instructions, which when executed by a processor, cause the processor to perform the method of any one of the above first aspects.
Drawings
The drawings to be used in the embodiments of the present application will be described below.
Fig. 1 is a schematic diagram of an android module development architecture provided in an embodiment of the present application;
fig. 2 is a flowchart illustrating an android module development method provided in an embodiment of the present application;
fig. 3 is a schematic flowchart of another android module development method provided in an embodiment of the present application;
fig. 4 is a schematic view of an application scenario of android module development provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an android module development device provided in 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 to make the technical solutions of the present invention better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The following are detailed below.
First, some terms in the present application are explained so as to be easily understood 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 mainstream mobile phone operating systems at present; the Android development referred to in the embodiments of the present application refers to application development based on an Android system.
(2) A module, which refers to a part of a (whole) complex system, may be understood as a single functional module. Modularization is a mode of decomposing a complex processing 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) An Android Archive (AAR) refers to a packing form of source codes, resource files and the like in Android, and is a zip-format compressed file.
(4) Maven, refers to a dependency management system, which is responsible for version management of AARs. It can also be called a Maven server as it is usually built in a remote server.
(5) The plug-in technology is a dynamic technology based on an Android system, and refers to a technology for dynamically loading and executing certain codes (namely plug-ins) without independently installing other application packages (Android packages) and upgrading the current apk on the basis of the installed applications of a user.
(6) Class (class), a construct of an object-oriented computer programming language in object-oriented programming, is a blueprint for creating objects that describes properties and methods common to created objects. A more rigid definition of a class is a cohesive package consisting of some specific metadata. It describes the behavior rules of some objects, which are called instances of the class. Classes have interfaces and structures. The interface describes how to interoperate with classes and their instances through methods, while the structure describes how data is divided into attributes in an instance. And a class file (class file) is a set of binary streams in units of 8-bit bytes.
The following describes a system architecture for android module development provided by an embodiment of the present application. Referring to fig. 1, fig. 1 is a schematic view of an android module development architecture provided in an embodiment of the present application, and includes a terminal 1 (taking a computer as an example in fig. 1), a server (taking a maven server as an example in fig. 1), and a terminal 2 (taking a smart phone as an example in fig. 1). Wherein the content of the first and second substances,
the computer stores all source codes of the main project and is used for compiling and modifying the codes. And carrying out module division on the codes of the main project and marking the target class codes. For example, the class (i.e., code) called by module A is found in module B, the code is marked, etc. In the embodiment of the present application, the terminal 1 is a computer as an example, but the terminal for operating the code is not limited to a computer.
And the server is used for storing codes of other modules on which a certain module depends. For example, after the target class code is determined, the target class code is sent to the maven server. The target class code is called from the server when the module is developed or verified.
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 packet corresponding to the module a that has been developed is sent to the terminal, the terminal decompresses the compressed packet into 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 called back to run to validate the functionality of module a.
It is to be understood that the illustration in fig. 1 is merely an exemplary implementation of the embodiments 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 following specifically analyzes and solves the technical problems provided in the present application in combination with the above 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 process of an android module development method provided in an embodiment of the present application, which can be applied to the system architecture in fig. 1, and will be described below with reference to fig. 2 from a single side of a computer. The method may comprise the following steps S201-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 project according to the characteristics of the first functional module. The characteristics of the first functional module may include that the first functional module calls a target class included in the second functional module; for example, module B is determined as the first functional module according to the fact that part of the code in module a is referred to 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 relationship is specifically a target class included in the second function module called by the first function module.
In one possible implementation, one or more same class names in the first functional module and the second functional module are determined; determining the one or more target classes in the first functional module according to the one or more same 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 the 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, and the copied source code of the first functional module is migrated to a module project created in advance.
Step S203: and compiling the main project to obtain a compiled target class file corresponding to the target class.
Specifically, all the functional modules in the main project 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 class file through compiling. Class files are the product of compiling the main engineered code. The target class is called by the first functional module and belongs to a class of a second functional module. And compiling the main project to obtain a target class file corresponding to the target class.
In a possible implementation manner, the compiling the main project to obtain a compiled target class file corresponding to the target class includes: adding an 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 functional modules of the main project to obtain class files of all functional modules, wherein byte code information of middle classification files of the class files comprises the annotations; and determining the class file of which the bytecode information contains 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 is annotated. Compiling all the functional modules in the main project 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 viewed in the byte code information; and determining the class file containing the annotation as a target class file.
Optionally adding an annotation to the one or more target classes, the annotation being used to tag 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 middle class files of the one or more class files comprises the annotations; and determining the partial class files as target class files corresponding to the one or more target classes according to the byte code information of the partial class files. For example, one or more target class files containing annotations are determined from a plurality of class files, wherein the plurality of class files are obtained by compiling a main project; the second class file is a class file obtained by compiling a target class containing the annotation in the main project; the first functional module and the second functional module are different functional modules of the main project. 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 project of the first functional module.
Specifically, after the target class file is determined, the target class file is sent to the code management server. For example, after the first functional module is extracted from the main project, the first functional module becomes an independent project to be edited and developed, and the first functional module can be on other servers or terminals. The independent project corresponding to the first functional module can call the target class file in the code management server to develop and perfect functions.
Optionally, copying the target class file to a second directory from a first directory in which the target class file is located; and compressing the target class file in 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, and 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 directory a and directory B are on different servers or terminals. And compressing the target class file in the directory B (the embodiment of the present invention does not limit the specific compression form), and sending the compressed target class file in the directory B to the code management server. The compressed object class file is stored and managed by the code management server, and when the first function module needs to call the object class file, a corresponding compressed packet (including the compressed object class file) can be downloaded from the code management server, and then the compressed packet or the corresponding object class file is decompressed.
In a possible implementation manner, the target class file is copied to a second directory from a first directory where the target class file is located; compressing the target class file in the second directory and then sending the compressed target class file to a first server; the target project is stored at 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, that is, the target class file is copied from the original directory to a new directory, such as the provideaapi directory. And compressing and packaging all class files in the directory into a module-app.
Further optionally, the module engineering of the first functional module is created on the code management server or other devices connected to the code management server. When the module project 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 that the calling of the target class file is realized. When the module project 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 project sends a calling instruction to the other equipment through the code management server, and after the other equipment receives, identifies and verifies the calling instruction, the module project 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 process of an android module development method provided in an embodiment of the present application, which can be applied to the system architecture in fig. 1, and will be 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 foregoing 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 project to obtain a compiled target class file corresponding to the target class.
Specifically, please refer to step S203.
Step S304: and uploading the target class file to a code management server for development and calling of the module project 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., the provideaapi directory). Optionally, the target class file is compressed and then sent to a code management server. For example, the object class file under the relevant directory (e.g., provideaapi directory) is compressed and packaged into aar format and sent to the 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 a compressed packet of the compressed and packaged target class file to a 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 self entry function or other modes, and development of self functions is continued. And sending a first project 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 project is completed, the target project is compiled to obtain a plurality of class files belonging to the first project. And 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 a dex flow is performed on a third class file corresponding to the first project, all class files needing to participate in the dex flow are filtered, and the aforesaid class files (i.e. referenced target class files) from module-app.
In a possible implementation manner, 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 a 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 may include a target class file of the called second functional module; when the main project installation package is generated, the target class file from the second functional module needs to be removed, because the first functional module and the second functional module are included in the main project, the removal of the target class file of the second functional module can prevent the code from being redundantly repeated. Or, when the module a needs to run and verify the self function, locating the entry function disclosed in the self code (the entry function can run the function of the module a after being called); after the compiling of the trigger module project A, compiling all source codes in the project into class files; before proceeding with the dex flow, all class files that need to participate in dex are filtered, and the class files from module-app. And the installation package is used for verifying the operation of the first functional module by the verifying equipment. For example, pushing the module-A.apk to a module directory of a mobile phone SD card directory; when the main project is started, decompressing the module-A.apk to the application built-in directory to obtain a dex file and a resource file of the module A; the main project loads a dex file and a resource file of the module A in a plug-in mode; and the main engineering reflection calls an entrance function of the module A, calls the function of the module A and verifies whether the module A is correctly realized.
Optionally, after removing a part of class files corresponding to the first functional module, the remaining class files corresponding to the first functional module are verified 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 packet; sending the compressed packet to the code management server; and calling the compressed packet from the code management server to perform function integration with the main project. For example, in the process of integration, the main engineering acquires a required corresponding compressed packet from the module engineering corresponding to each functional module; and then 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 view of an application scenario of android module development provided in the embodiment of the present application. The architecture of android module development can be applied to the scenario shown in fig. 4. As shown in fig. 4, wherein the main project is a project before modularization transformation; the main project internally comprises a plurality of modules (such as codes of a first functional module (namely, the module B) and a second functional module (namely, the module A));
firstly, when a module A needs to be extracted from a main project and becomes a module independently, a module project A is newly built, wherein the module project 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 the module logic of the module A; when the module A needs to depend on the function of the module B, and the module B is not pulled out from the main project, 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 main project compilation, and compiling all source codes into class files through a javac tool; optionally, the resource file is generated by aapt. Packing the remaining dex files and resource files of the main project into a module-app.apk; and sending to the terminal (application). Further optionally, the plug-in framework is started when the mobile phone runs the program, and the subsequently received apk (i.e. module-a.apk) of the module a is run.
3. Traversing all generated class files, analyzing byte code information of the class files, and copying the class files to a providedAPI directory if the class files contain @ API annotations;
4. packaging all class files in the ProvidedAPI directory into module-app.
5. Aar refers to module-app, calls the classes in the module A, and continues to develop the functions of the module A. Optionally, when the function of the module a is developed, the resource file is also obtained through the aapt tool, and the class file corresponding to the project is also obtained through the javac.
Then, when the module a needs to run the function of verifying itself, the following steps can be performed: 1. module A provides an open entry function, and the entry function can run the function of module A after being called; 2. triggering the compiling of the module engineering A; 3. compiling all source codes in the project into class files, filtering all class files needing to participate in dex before a dex flow is carried out, and removing the class files from module-app.
It should be noted that, 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 a mobile phone SD card directory; restarting the main project, and decompressing the module-A.apk to the application built-in directory by the main project when the main project is started to obtain a dex file and a resource file of the module A; the main project loads a dex file and a resource file of the module A in a plug-in mode; the main engineering reflection calls an entry function of the module A, the function of the module A is called, and a developer starts to verify whether the module A is correctly realized; after the module A is developed and verified, packaging and releasing the module A into a module-A.aar, and uploading the module A to a Maven server; and the main project refers to module-A.aar to complete function integration, and finally the APK is packaged and issued.
It is understood that the application scenario in fig. 4 is only an exemplary implementation manner in 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 better implement the above scheme of the present application, an embodiment of the present application further provides an android module development device correspondingly, please refer to fig. 5, where fig. 5 is a schematic structural diagram of the android module development device provided in the embodiment of the present application; the following detailed description is made with reference to fig. 5:
as shown in fig. 5, the android module development device 50 may include a determination unit 501, a migration unit 502, a compiling unit 503, a calling unit 504, a checking unit 505, and a compression unit 506; optional units include a verification unit 505 and a compression unit 506; wherein the content of the first and second substances,
a determining unit 501, configured to determine a first function module and a second function module that have a call relationship in a main project, where the call relationship is specifically a target class that the first function module calls the second function module;
a migration unit 502, configured to migrate the source code of the first functional module from the main project to a module project created in advance;
a compiling unit 503, configured to compile the main project to obtain a compiled target class file corresponding to the target class; (ii) a
A calling unit 504, configured to upload the target class file to a code management server, so as to develop and call a module project of the first functional module.
In a possible implementation manner, the compiling unit 503 is specifically configured to: adding an 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 functional modules of the main project to obtain class files of all functional modules, wherein byte code information of middle classification files of the class files comprises the annotations; and determining the class file of which the bytecode information contains the annotation as a target class file corresponding to the target class.
In a possible implementation manner, the invoking unit 504 is specifically configured to: copying the target class file to a second directory from a first directory where the target class file is located; and compressing the target class file in 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 checking unit 505, configured to: 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 a 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; and the installation package is used for verifying the operation of the first functional module by the verifying equipment.
In a possible implementation, the apparatus further includes a compressing unit 506, configured to: after the verification of the first functional module is finished, compressing the target class file of the first functional module into a compressed packet; sending the compressed packet to the code management server; and calling the compressed packet from the code management server to perform function integration with the main project.
It should be noted that specific implementation and beneficial effects of each unit in the android module development device 50 shown in fig. 5 may correspond to the corresponding descriptions in the method embodiments shown in fig. 2 to fig. 3, and are not described again here.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present disclosure; 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 via a bus 604. The terminal device 60 may be a tablet computer, a personal computer, or other terminal device, the input device 606 may be a keyboard, a mouse, a voice input device, a touch panel, or other device, and the output device may be a display, or other device.
The memory 602 includes, but is not limited to, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), or a portable read-only memory (CD-ROM), and the memory 602 is used for storing related instructions and data. The communication interface 603 is used for receiving and transmitting data.
The processor 601 may be one or more Central Processing Units (CPUs), and in the case that 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 function module and a second function module having a call relationship in a main project, where the call relationship is specifically a target class included in a case that the first function module calls the second function module; migrating the source code 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 project of the first functional module.
In one possible implementation, the processor 601 is configured to: adding an 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 functional modules of the main project to obtain class files of all functional modules, wherein byte code information of middle classification files of the class files comprises the annotations; and determining the class file of which the bytecode information contains 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 to a second directory from a first directory where the target class file is located; and compressing the target class file in 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 devices connected to the code management server.
In one possible implementation, the processor 601 is configured to: 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 a 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; and the installation package is used for verifying the operation of the first functional module by the verifying equipment.
In one possible implementation, the processor 601 is configured to: after the verification of the first functional module is finished, compressing the target class file of the first functional module into a compressed packet; sending the compressed packet to the code management server; and calling the compressed packet from the code management server to perform function integration with the main project.
In the embodiment of the application, a target class in the main project is determined, wherein the target class is a class of the first functional module and has a calling relationship with the second functional module of the main project. Compiling all functional modules in the main project, including the target class in the first functional module; finding a target class file corresponding to the target class from class files obtained by compiling the main project; and calling the target class file sent to the target project when the target project corresponding to the second functional module is developed or verified. By implementing the embodiment of the invention, the function development of a certain module depending on the code of the required module can be supported under the condition that the module depending on the module is not taken out and finished, and the related functions can be independently verified by running the current module, so that the development work of the current module cannot be influenced by the development progress of another module, the independent module development effect 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 to fig. 4.
Embodiments of the present application also provide a computer-readable storage medium, which stores a computer program, where the computer program includes program instructions, and when the program instructions are executed by a processor, the method flows shown in fig. 2 to fig. 4 are implemented.
Embodiments of the present application also provide a computer program, which includes program instructions, and when the program instructions are executed by a processor, the method flows shown in fig. 2 to fig. 4 are implemented.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A method for developing an android functional module is characterized by comprising the following steps:
determining a first functional module and a second functional module which have a calling relationship in a main project, wherein the calling relationship is a target class included in the second functional module called by the first functional module;
migrating the source code 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 project of the first functional module.
2. The method of claim 1, wherein compiling the main project to obtain a compiled target class file corresponding to the target class comprises:
adding an 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 functional modules of the main project to obtain class files of all functional modules, wherein byte code information of middle classification files of the class files comprises the annotations;
and determining the class file of which the bytecode information contains the annotation as a target class file corresponding to the target class.
3. The method of claim 1, wherein uploading the target class file to a code management server comprises:
copying the target class file to a second directory from a first directory where the target class file is located;
and compressing the target class file in the second directory and then sending the compressed target class file to a code management server.
4. 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.
5. The method of claim 1, further comprising:
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 a 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; and the installation package is used for verifying the operation of the first functional module by the verifying equipment.
6. The method of claim 5, further comprising:
after the verification of the first functional module is finished, compressing the target class file of the first functional module into a compressed packet;
sending the compressed packet to the code management server;
and calling the compressed packet from the code management server to perform function integration with the main project.
7. An apparatus for android functional module development, comprising:
the system comprises a determining unit and a processing unit, wherein the determining unit is used for determining a first functional module and a second functional module which have a calling relationship in a main project, and the calling relationship is specifically a target class contained in the second functional module called by the first functional module;
a migration unit, configured to migrate the source code of the first functional module from the main project to a module project created in advance;
the compiling unit is used for compiling the main project 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 develop and call the module engineering of the first functional module.
8. 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-7.
9. A computer program, characterized in that the computer program comprises instructions which, when executed by a computer, cause the computer to carry out the method according to any one of claims 1-7.
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 true CN111367510A (en) 2020-07-03
CN111367510B 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)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112015394A (en) * 2020-08-27 2020-12-01 北京百度网讯科技有限公司 Android functional 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
CN112286533A (en) * 2020-11-16 2021-01-29 广州速威智能系统科技有限公司 Thermal restoration method and device for cloud service
CN112346778A (en) * 2020-10-28 2021-02-09 常州微亿智造科技有限公司 Optimization method for automatically generating byte codes during compiling of Java program
CN112527306A (en) * 2020-10-27 2021-03-19 百果园技术(新加坡)有限公司 Method, device, equipment and medium for realizing independence of modules in project development
CN112631622A (en) * 2020-12-29 2021-04-09 Oppo广东移动通信有限公司 Application installation method and device, server and computer readable medium
CN112685029A (en) * 2020-12-30 2021-04-20 京东数字科技控股股份有限公司 Visual template generation method, device, equipment and storage medium
CN113434219A (en) * 2021-07-08 2021-09-24 展讯通信(天津)有限公司 Information configuration method and equipment for engineering project
CN115981614A (en) * 2023-02-24 2023-04-18 美云智数科技有限公司 Project engineering modularization processing method, electronic equipment and computer storage medium

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090249369A1 (en) * 2008-03-27 2009-10-01 Akihiro Itoh Module-to-module association support method, program, and system
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

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090249369A1 (en) * 2008-03-27 2009-10-01 Akihiro Itoh Module-to-module association support method, program, and system
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

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112015394A (en) * 2020-08-27 2020-12-01 北京百度网讯科技有限公司 Android functional module development method and device, computer system and storage medium
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
CN112527306B (en) * 2020-10-27 2024-05-28 百果园技术(新加坡)有限公司 Method, device, equipment and medium for realizing independence of modules in project development
CN112346778A (en) * 2020-10-28 2021-02-09 常州微亿智造科技有限公司 Optimization method for automatically generating byte codes during compiling of Java program
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
CN112286533A (en) * 2020-11-16 2021-01-29 广州速威智能系统科技有限公司 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
CN112685029A (en) * 2020-12-30 2021-04-20 京东数字科技控股股份有限公司 Visual template generation method, device, equipment and storage medium
CN113434219B (en) * 2021-07-08 2024-03-26 展讯通信(天津)有限公司 Information configuration method and equipment for engineering project
CN113434219A (en) * 2021-07-08 2021-09-24 展讯通信(天津)有限公司 Information configuration method and equipment for engineering project
CN115981614A (en) * 2023-02-24 2023-04-18 美云智数科技有限公司 Project engineering modularization processing method, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN111367510B (en) 2024-03-19

Similar Documents

Publication Publication Date Title
CN111367510B (en) Android function module development method and device
CN105718289B (en) Component relation establishing method and equipment
US11704115B2 (en) Software pipeline configuration
CN110059456B (en) Code protection method, code protection device, storage medium and electronic equipment
CN111580926A (en) Model publishing method, model deploying method, model publishing device, model deploying device, model publishing equipment and storage medium
CN111399840B (en) Module development method and device
CN112433747B (en) Differential upgrading method and system suitable for Software Development Kit (SDK)
US10083029B2 (en) Detect application defects by correlating contracts in application dependencies
WO2018032653A1 (en) Function implementing method and apparatus for java card application
CN113805882A (en) Method and device for developing application program, electronic equipment and storage medium
CN114706564B (en) Software package manufacturing method and device, electronic equipment and storage medium
CN111209001A (en) Method, system, equipment and medium for batch generation of APKs of android channels
CN115185550A (en) Service deployment method, device, computer equipment and storage medium
US9904574B2 (en) Parallel computing without requiring antecedent code deployment
CN110806891B (en) Method and device for generating software version of embedded device
CN114546581A (en) Service-free container starting method and related equipment
CN111258802A (en) Method for capturing application program crash information and related equipment
CN116578282A (en) Code generation method, device, electronic equipment and medium
CN112748946A (en) Application program installation file generation method and device, computing equipment and storage medium
CN106778270B (en) Malicious application detection method and system
CN112988148B (en) Multi-block-chain and cross-platform supporting SDK generation method and device
CN114174983B (en) Method and system for optimized automatic verification of advanced constructs
CN114356379A (en) Backup-based service upgrading method, device, equipment and 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

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