CN112328241B - Method and device for creating Android library module dependency relationship in application program development - Google Patents

Method and device for creating Android library module dependency relationship in application program development Download PDF

Info

Publication number
CN112328241B
CN112328241B CN202011350207.3A CN202011350207A CN112328241B CN 112328241 B CN112328241 B CN 112328241B CN 202011350207 A CN202011350207 A CN 202011350207A CN 112328241 B CN112328241 B CN 112328241B
Authority
CN
China
Prior art keywords
android
module
library module
configuration file
configuration
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
CN202011350207.3A
Other languages
Chinese (zh)
Other versions
CN112328241A (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.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology 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 Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN202011350207.3A priority Critical patent/CN112328241B/en
Publication of CN112328241A publication Critical patent/CN112328241A/en
Application granted granted Critical
Publication of CN112328241B publication Critical patent/CN112328241B/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
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The application discloses a method and a device for creating an Android library module dependency relationship in application program development, wherein an Android library module folder is created for each first configuration file under the root directory of an Android application development module; writing dynamic configuration parameters of the Android application development module and dependency parameters required by each Android library module into a first configuration file to simulate each Android library module; and respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module to establish a dependency relationship, so that the Android application development module of the application program and the main project refer to the simulated Android library modules according to the dependency relationship. Therefore, the Android library module can be dynamically created, the automatically created Android library module can be dynamically dependent on the configuration of the main engineering and the Android application development module, the development process is simplified while the Android application development module and the main engineering can be referred to the Android library module, and the development efficiency is improved.

Description

Method and device for creating Android library module dependency relationship in application program development
The application discloses a method and a device for creating Android library module dependency in application program development, which are filed in China patent office at 3 months and 16 days in 2020, and are classified in China patent application with application number of 202010183863.2.
Technical Field
The application relates to the technical field of computers, in particular to a method and a device for creating Android library module dependency in application program development.
Background
In the process of automatically analyzing and calculating the size of AAR (Android Archive) in the APP, one link is mock (analog) of an AAR, namely, only the resource files in the archive AAR files are extracted after the archive AAR files are decompressed, and then the resource files are combined into the resource files of the main engineering. AAR is a binary archive file of Android library items, and comprises Java files, resource files, android management.xml (configuration entry), building.gradle (package) configuration files and the like.
The main project is Android code project for developing a service line of the APP, and comprises an Android application development module and an Android library module. The Android library module (Android Library Module) is a module which can independently run in Android code engineering. The Android library module is structurally the same as the Android application development module, except that the Android library module can be packaged to generate an AAR dependent package to be referenced by other modules, but cannot generate an apk installation package to run on a mobile phone. The Android application development module can generate an apk installation package to run on the mobile phone, and the Android application development module can refer to the Android library module and then realize a certain function of the APP through packaging.
When the resource files extracted from the AAR are merged into the resource files of the main engineering, if the ID names of part of the resource files are the same, the resource files with the same ID names cannot exist at the same time, and conflicts occur. In order to avoid the conflict, a method is generally adopted, wherein the extracted resource file is put into a new Android library module.
However, if a new Android library module is to be referred to by other modules, a dependency relationship between the Android library module and the corresponding module needs to be established. The existing Android library module creation mode generally needs to be manually created by means of a visual compiler, and cannot be dynamically generated at present; and no dependency is automatically added at creation time. Therefore, if the Android library module is to be referred to by other modules, the dependency relationship needs to be manually added, so that the process of developing the Android library module is complicated and the efficiency is low.
Disclosure of Invention
The application provides a method and a device for creating Android library module dependency relationship in application program development, which are used for solving the problem of low development efficiency of the existing method for creating the Android library module in application program development.
In a first aspect, the present application provides a method for creating Android library module dependencies in application program development, including the following steps:
When an AAR file of an application program is decompressed and extracted to be combined with a configuration file of a main project of the application program, for the first configuration files with the same ID names, creating an Android library module folder for each first configuration file under the root directory of an Android application development module;
acquiring a second configuration file of an Android application development module of the application program, wherein the second configuration file comprises dynamic configuration parameters and a root directory of the Android application development module, and the dynamic configuration parameters are parameters for keeping version numbers of the Android application development module and the Android library module consistent;
obtaining the dependent parameters required by each Android library module, wherein the dependent parameters are parameters used for establishing dependence of the Android library module and the Android application development module;
writing the dynamic configuration parameters and each dependent parameter into the first configuration file of each Android library module folder respectively so as to simulate each Android library module;
and respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module to establish the dependency relationship between each simulated Android library module and the Android application development module and the main project for the application program, so that the Android application development module and the main project of the application program refer to the simulated Android library module according to the dependency relationship.
Further, writing the dynamic configuration parameters and each dependent parameter into the first configuration file of each Android library module folder respectively includes:
the dynamic configuration parameters comprise a compiling SDK version number and a packaging construction tool version number, and the first configuration file of the Android library module folder comprises a configuration entry configuration file and a packaging configuration file;
writing the compiled SDK version number and the packaging construction tool version number into a configuration entry configuration file and a packaging configuration file of each Android library module folder in a dynamic mode;
and writing the dependent parameters required by each Android library module into the configuration inlet configuration file and the packaging configuration file of each Android library module folder in a static form.
Further, the adding the first configuration file of each simulated Android library module to the configuration file of the main project and the second configuration file of the Android application development module respectively, so as to establish a dependency relationship between each simulated Android library module and the Android application development module and the main project for the application program, includes:
Acquiring package names and root directory entry parameters of each simulated Android library module;
adding the package name of each simulated Android library module into the configuration file of the main project, and establishing the dependency relationship between each simulated Android library module and the main project;
acquiring dependent item parameters of the second configuration file in the Android application development module;
and adding the root directory entry parameter of each simulated Android library module into the dependency item parameter, and establishing the dependency relationship between each simulated Android library module and the Android application development module.
Further, the method further comprises the following steps:
compiling and packaging each simulated Android library module with a dependency relationship to obtain each application apk package, wherein the application apk package is used for realizing the reference of the simulated Android library module by the Android application development module and the main engineering.
Further, after writing the dynamic configuration parameters into the first configuration file of each Android library module folder, the method further includes:
acquiring configuration content templates corresponding to the first configuration files of each Android library module folder;
And writing the obtained configuration content templates into the first configuration files of each Android library module folder.
In a second aspect, the present application provides an apparatus for creating Android library module dependencies in application program development, including:
the system comprises an AAR creation module, an Android application development module and an application program management module, wherein the AAR creation module is used for creating an Android library module folder for each first configuration file under the root directory of the Android application development module when the first configuration file extracted by decompression is executed on the AAR file of the application program so as to be combined with the configuration file of the main project of the application program, and the first configuration files with the same ID names exist;
the configuration file acquisition module is used for acquiring a second configuration file of the Android application development module of the application program, wherein the second configuration file comprises dynamic configuration parameters and a root directory of the Android application development module, and the dynamic configuration parameters are parameters for keeping the version numbers of the Android application development module and the Android library module consistent;
the dependent parameter acquisition module is used for acquiring the dependent parameters required by each Android library module, wherein the dependent parameters are parameters used for establishing dependence of the Android library modules and the Android application development modules;
The parameter writing module is used for writing the dynamic configuration parameters and each dependent parameter into the first configuration file of each Android library module folder respectively so as to simulate each Android library module;
the dependency relation establishing module is used for respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module so as to establish the dependency relation between each simulated Android library module and the Android application development module and the main project for the application program, so that the Android application development module and the main project of the application program refer to the simulated Android library module according to the dependency relation.
Further, the parameter writing module includes:
the dynamic configuration parameters comprise a compiling SDK version number and a packaging construction tool version number, and the first configuration file of the Android library module folder comprises a configuration entry configuration file and a packaging configuration file;
the first parameter writing unit is used for writing the compiled SDK version number and the packaging construction tool version number into the configuration entry configuration file and the packaging configuration file of each Android library module folder in a dynamic mode;
And the second parameter writing unit is used for writing the dependent parameters required by each simulated Android library module into the configuration entry configuration file and the packaging configuration file of each Android library module folder in a static mode.
Further, the dependency relationship establishing module includes:
the first parameter acquisition unit is used for acquiring the package name and the root directory entry parameter of each simulated Android library module;
the first dependency relation establishing unit is used for adding the package name of each simulated Android library module into the configuration file of the main project, and establishing the dependency relation between the newly generated Android library module and the main project;
the second parameter acquisition unit is used for acquiring the dependent item parameters of the second configuration file in the Android application development module;
and the second dependency relation establishing unit is used for adding the root directory entry parameter of each simulated Android library module into the dependency item parameter and establishing the dependency relation between each simulated Android library module and the Android application development module.
Further, the method further comprises the following steps:
and the compiling and packing module is used for compiling and packing each simulated Android library module with the dependency relationship to obtain each application apk package, and the application apk package is used for realizing the reference of the simulated Android library module by the Android application development module and the main engineering.
Further, the method further comprises the following steps:
the configuration content template acquisition module is used for acquiring configuration content templates corresponding to the first configuration files of each Android library module folder;
and the configuration content writing module is used for writing the acquired configuration content templates into the first configuration files of each Android library module folder.
In a third aspect, the present application provides an electronic device comprising:
a memory for storing program instructions;
and the processor is used for calling and executing the program instructions in the memory so as to realize the method for creating the Android library module dependency relationship in the application program development of the first aspect.
In a fourth aspect, the present application provides a storage medium, in which a computer program is stored, and when at least one processor of an apparatus for creating an Android library module dependency in an application development executes the computer program, the apparatus for creating an Android library module dependency in an application development executes the method for creating an Android library module dependency in an application development according to the first aspect.
According to the technical scheme, the method and the device for creating the Android library module dependency relationship in the application program development are provided, when the first configuration files extracted by decompression are executed on the AAR files of the application program so as to be combined to the configuration files of the main engineering of the application program, android library module folders are respectively created for each first configuration file under the root directory of the Android application development module; and acquiring dynamic configuration parameters of the Android application development modules and dependency parameters required by each Android library module. Writing the dynamic configuration parameters and each dependent parameter into a first configuration file of each Android library module folder respectively so as to simulate each Android library module; and respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module to establish the dependency relationship between each simulated Android library module and the Android application development module and the main project of the application program, so that the Android application development module and the main project of the application program refer to the simulated Android library modules according to the dependency relationship. Therefore, the method can realize an automatic creation process, does not need manual intervention when the Android library module is required to be created, and can be dynamically created through a program at any time. And each Android library module automatically created can dynamically depend on the configuration of the main engineering and the Android application development module, so that the development process is simplified and the development efficiency is improved while the Android application development module and the main engineering can be referred to the simulated Android library module in the application development.
Drawings
In order to more clearly illustrate the technical solution of the present application, the drawings that are needed in the embodiments will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flowchart of a method for creating Android library module dependencies in application development provided by an embodiment of the present application;
FIG. 2 is a flowchart of a parameter writing method according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for establishing a dependency relationship according to an embodiment of the present application;
fig. 4 is a structural block diagram of a device for creating Android library module dependency in application development according to an embodiment of the present application;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
In order to enable the process of creating the Android library module to be completed dynamically without manually creating by means of a visual compiler, the embodiment of the application provides an operation script which can extract a resource file in a mock AAR in the process of calculating the dependent size of the AAR in the APP, automatically create the Android library module, add the extracted resource file into the Android library module, avoid the phenomenon of conflict when the resource file is directly combined into the resource file of a main project, and has high development efficiency.
Fig. 1 is a flowchart of a method for creating Android library module dependencies in application development according to an embodiment of the present invention. Referring to fig. 1, an embodiment of the present invention provides a method for creating an Android library module dependency relationship in application program development, an execution subject is an operation script, and may automatically create an Android library module, and create a dependency between the Android library module and a main engineering and Android application development module, where the method includes the following steps:
s1, when the first configuration files extracted by decompression are executed on the AAR files of the application program so as to be combined to the configuration files of the main engineering of the application program, the first configuration files with the same ID names are used for creating Android library module folders for each first configuration file under the root directory of the Android application development module.
The method provided by the embodiment is applied to the scene of merging the first configuration file into the configuration file of the main project of the application program by decompressing and extracting the first configuration file of the AAR file according to the mock technology in the process of developing the application program and calculating the AAR dependency, and when the first configuration file is merged into the configuration file of the main project, the configuration files are easy to collide due to the fact that the ID names are the same, and the phenomenon that the configuration files cannot exist simultaneously is avoided. In order to solve the problem, the Android library module can be automatically created by the method provided by the embodiment.
When the Android application development module is created, an Android library module folder is created in the root directory of the Android application development module based on the first configuration file. The root directory of the Android application development module is the uppermost parameter of the configuration file, and the running script automatically creates an Android library module file under the root directory, namely an AAR file of a mock Android library module. The first configuration file may be a resource file extracted from the AAR file.
When an application program is developed, a large number of AAR files are cited, and the AAR files are packaged and generated by the Android library modules, so that corresponding Android library module folders can be respectively created for the first configuration files extracted from each AAR file. A first configuration file creates an Android library module folder.
And generating an Android library module under the root directory of the Android application development module, and packaging and generating files necessary for AAR, wherein the files comprise a root directory (zucker), a directory (zucker/src/main) for storing codes and resource files, and configuration files AndroidManifest.xml and build.gradle.
S2, acquiring a second configuration file of the Android application development module of the application program, wherein the second configuration file comprises dynamic configuration parameters and a root directory of the Android application development module, and the dynamic configuration parameters are parameters for keeping the version numbers of the Android application development module and the Android library module consistent.
S3, acquiring the dependent parameters required by each Android library module, wherein the dependent parameters are parameters used for establishing the Android library modules and the Android application development module.
In order to enable the automatically created Android library module to establish a dependency with the Android application development module, relevant parameters of the Android application development module, such as a second configuration file, including dynamic configuration parameters and a root directory, need to be written in the Android library module.
The dynamic configuration parameters include compiled SDK version number (compileSdkVersion) and packaged build tool version number (buildToolsVersion). The configuration parameters of the Android application development module are read, so that the problem that the environment cannot be successfully packaged due to mismatching of the parameters is mainly solved, namely, compiling of the SDK version number and the packaging and constructing tool version number can ensure that the Android library module and the Android application development module which are created later have the same version number, and dependence is built between the Android library module and the Android application development module. Wherein the compiled SDK version number and the package build tool version number must be written dynamically.
In calculating the AAR dependent size in APP, it is common to mock (simulate) an AAR, i.e. a file of an Android library module. The original AAR file includes Java file, resource file, android management. The Android management file and the building file are files which are needed to exist for each configuration file, and the establishment of dependence between the Android library module and the Android application development module can be realized. AndroidManifest.xml is used to implement page configuration entries, such as boot page, boot class entries.
That is, the Android library module is automatically created, and the structure of the Android library module and the necessary files for packaging the AAR need to be fully known. And the parameters necessary for the subsequent Android library module creation and dependence establishment are extracted when the mock Android library module is simulated, and the dependent parameters comprise Android management. Xml related parameters and building. Gradle related parameters. One Android library module corresponds to one dependent parameter.
And S4, respectively writing the dynamic configuration parameters and each dependent parameter into a first configuration file of each Android library module folder so as to simulate each Android library module.
After each Android library module folder (AAR) is dynamically created, two configuration files, namely, a configuration entry (Android management. Xml) configuration file and a packaging (building) configuration file, are included under the folder. In order to facilitate the Android library modules to establish dependence with the Android application development modules, dynamic configuration parameters of the Android application development modules need to be written into configuration files of each Android library module. In order to make the mock Android library module and the original Android library module have the same configuration, the dependency parameters required by the extracted simulated Android library module need to be written into the first configuration file of the Android library module.
After the Android library module folders are established, initialization data including dynamic configuration parameters of the Android application development modules and extracted dependent parameters required by simulating each Android library module are written into a first configuration file of each Android library module folder.
Fig. 2 is a flowchart of a parameter writing method according to an embodiment of the present invention. For this purpose, referring to fig. 2, to achieve writing of relevant parameters, the present embodiment proceeds as follows:
s41, writing the compiled SDK version number and the packaging construction tool version number into a configuration entry configuration file and a packaging configuration file of each Android library module folder in a dynamic mode.
The first configuration file of the Android library module folder comprises a configuration inlet configuration file and a packaging configuration file; the dynamic configuration parameters comprise a compiling SDK version number and a packaging construction tool version number, and in order to ensure the consistency of the version numbers, the compiling SDK version number and the packaging construction tool version number are required to be written into two configuration files of each Android library module folder in a dynamic mode, namely, the compiling SDK version number and the packaging construction tool version number are respectively dynamically written into each configuration entry configuration file, and the compiling SDK version number and the packaging construction tool version number are respectively dynamically written into each packaging configuration file.
S42, writing the dependent parameters required by each simulated Android library module into the configuration entry configuration file and the packaging configuration file of each Android library module folder in a static mode.
The dependent parameters required for simulating each Android library module include Android management related parameters and build. The android manifest.xml (page configuration entry) related parameter and the build.gradle (package configuration) related parameter are respectively written into each configuration entry configuration file and each package configuration file in a static form, for example, according to a common writing module, that is, the android manifest.xml (page configuration entry) related parameter is statically written into each configuration entry configuration file, and the build.gradle (package configuration) related parameter is statically written into each package configuration file.
In one embodiment, after writing the dynamic configuration parameters into the first configuration file of each Android library module folder, the method further optionally includes: acquiring configuration content templates corresponding to the first configuration files of each Android library module folder; and writing the obtained configuration content templates into the first configuration files of each Android library module folder.
The first configuration file of each Android library module folder comprises the dynamic configuration parameters and the dependent parameters, other configuration contents are also included, the other configuration contents can be preset to be configuration content templates, after the dynamic configuration parameters and each dependent parameter are written into the first configuration file, the configuration content templates corresponding to the first configuration file are obtained, the configuration content templates are written into the first configuration file of each Android library module folder, and the configuration of the first configuration file of each Android library module folder is completed.
In addition to writing initialization data in the first configuration file of each Android library module folder, other configuration contents can be written into the configuration files of the Android library module folders according to a common writing template. For example, parameters related to the Android library modules, such as a root directory (zucker), a code and a directory (zucker/src/main) in which resource files are stored, and the like, are written into the first configuration file of each Android library module folder.
On the basis of dynamically generating the Android library module, more expansion of users can be satisfied, for example: the developer can initialize configuration while generating the Android library module, and write in codes with new requirements, so that the creation of richer Android library modules is realized. The process of writing new code to implement the function may be performed in the process of creating the Android library module folder.
The writing method provided by the embodiment can enable the necessary parameter configuration in the build. Gradle configuration file in each Android library module folder to be consistent with that of the Android application development module, further ensure that the result manually created by the visual compiler is consistent with that of the result manually created by the visual compiler, and can be normally packaged to generate an AAR archive file.
And respectively writing dynamic configuration parameters and dependent parameters into the Android library module created by the running script to obtain the simulated Android library module. The simulated Android library module is a mock Android library module and has the same resource files and related configurations as the original Android library module.
S5, respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module, so as to establish the dependency relationship between each simulated Android library module and the Android application development module and the main project of the application program, and enabling the Android application development module and the main project of the application program to refer to the simulated Android library modules according to the dependency relationship.
The main project is a shell project and is composed of a plurality of modules, such as an Android application development module, an Android library module and the like. When the Android library module is created, the Android library module is in a free state and is not associated with the main engineering, namely, is not referenced by the Android application development module. At this time, a final step is required, and each simulated Android library module is added to the configuration of the main engineering and the Android application development module, so that the installation package containing the Android library module codes and the resource files can be completely packaged and output.
That is, after the Android library module is created, in order to enable the simulated Android library module to be referenced by other modules, such as by the Android application development module and the main engineering, an installation package is generated to run on the terminal. In this embodiment, a dependency relationship between each simulated Android library module and the main engineering and Android application development modules needs to be established.
The method for automatically adding the dependency relationship is to write the first configuration file of each simulated Android library module into the configuration file of the main project and the configuration files of the Android application development modules.
Fig. 3 is a flowchart of a method for establishing a dependency relationship according to an embodiment of the present invention. Specifically, in this embodiment, referring to fig. 3, the building of the dependency relationship between each simulated Android library module and the Android application development module and the main engineering respectively according to the following steps includes:
s51, acquiring the package name and the root directory entry parameter of each simulated Android library module.
When adding a dependency to a main project, the package name of the Android library module is required to be used as an adding identifier. The original Android library modules have corresponding package names, and each simulated Android library module is obtained for the mock original Android library module, so that the package name of each simulated Android library module is the same as the package name of the corresponding original Android library module.
When adding a dependency to an Android application development module, the root directory entry parameter of each simulated Android library module is required to be used as an adding identifier. The root directory entry parameter may provide an entry when the Android application development module is booted.
S52, adding the package name of each simulated Android library module into a configuration file of the main project, and establishing the dependency relationship between each simulated Android library module and the main project.
And adding dependence into the main project, namely adding the name of each simulated Android library module into a setting. Gradle file of the main project according to script statements, namely adding the package name of each simulated Android library module into a configuration file (setting. Gradle) of the main project, and establishing the dependence relationship between each simulated Android library module and the main project.
S53, acquiring dependent item parameters of a second configuration file in the Android application development module.
When adding a dependency to the Android application development module, a new dependency parameter needs to be introduced as a dependency parameter of the Android application development module, the dependency parameter can be configured in a second configuration file, and the dependency parameter can realize that a dependency relationship is established between each simulated Android library module and the Android application development module.
S54, adding the root directory entry parameter of each simulated Android library module into the dependency item parameter, and establishing the dependency relationship between each simulated Android library module and the Android application development module.
Adding a dependency into the Android application development module is to add a row of dependency sentences into the dependency parameters of the Android application development module: implementation project (': zucker'), adding the root directory entry parameter of each simulated Android library module into the dependency item parameter, and establishing the dependency relationship between each simulated Android library module and the Android application development module.
By the method, the Android library module can be dynamically generated and the dependence can be actively added, so that the work of creating the Android library module by manually relying on the visualization tool is replaced, the development process is simple, and the development efficiency of the Android library module is higher.
After the addition of the dependency relationship between each simulated Android library module and the main engineering and Android application development modules is completed, compiling and packaging each simulated Android library module with the dependency relationship to obtain each application apk package, wherein the application apk package is used for realizing the reference of the simulated Android library module by the Android application development modules and the main engineering.
And compiling and packaging each simulated Android library module, wherein the simulated Android library modules comprise root directories (zucker), directories (zucker/src/main) for storing codes and resource files and configuration files, packaging the root directories (zucker/src/main) and the code and resource files into folders of the same level, and outputting an installation package (application apk package) containing codes and resource files of the Android library modules through complete packaging.
According to the technical scheme, in the method for creating the Android library module dependency relationship in application program development, when the first configuration files extracted by decompression are executed on the AAR files of the application program and are combined to the configuration files of the main engineering of the application program, android library module folders are created for each first configuration file respectively under the root directory of the Android application development module; and acquiring dynamic configuration parameters of the Android application development modules and dependency parameters required by each Android library module. Writing the dynamic configuration parameters and each dependent parameter into a first configuration file of each Android library module folder respectively so as to simulate each Android library module; and respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module to establish the dependency relationship between each simulated Android library module and the Android application development module and the main project of the application program, so that the Android application development module and the main project of the application program refer to the simulated Android library modules according to the dependency relationship. Therefore, the method can realize an automatic creation process, does not need manual intervention when the Android library module is required to be created, and can be dynamically created through a program at any time. And each Android library module automatically created can dynamically depend on the configuration of the main engineering and the Android application development module, so that the development process is simplified and the development efficiency is improved while the Android application development module and the main engineering can be referred to the simulated Android library module in the application development.
Fig. 4 is a structural block diagram of a device for creating Android library module dependency relationships in application program development according to an embodiment of the present application. Referring to fig. 4, the present application provides an apparatus for creating an Android library module dependency in application development, for executing the relevant steps of the method for creating an Android library module dependency in application development shown in fig. 1, where the apparatus includes: the AAR creation module 10 is configured to create an Android library module folder for each first configuration file under a root directory of the Android application development module when the first configuration file extracted by decompressing the AAR file of the application program is executed to be merged into the configuration file of the main project of the application program, where the first configuration files are named the same for the existing IDs; the configuration file obtaining module 20 is configured to obtain a second configuration file of the Android application development module of the application program, where the second configuration file includes a dynamic configuration parameter of the Android application development module and a root directory, and the dynamic configuration parameter is a parameter for maintaining version number consistency of the Android application development module and the Android library module; the dependency parameter obtaining module 30 is configured to obtain dependency parameters required by each Android library module, where the dependency parameters are parameters used to establish dependency between the Android library module and the Android application development module; a parameter writing module 40, configured to write the dynamic configuration parameters and each of the dependent parameters into the first configuration file of each Android library module folder, so as to simulate each Android library module; the dependency relationship establishing module 50 is configured to add a first configuration file of each simulated Android library module to a configuration file of the main project and the second configuration file of the Android application development module, so as to establish a dependency relationship between each simulated Android library module and the Android application development module and the main project, respectively, for the application program, so that the Android application development module and the main project of the application program refer to the simulated Android library module according to the dependency relationship.
Further, the parameter writing module 40 includes: the dynamic configuration parameters comprise a compiling SDK version number and a packaging construction tool version number, and the first configuration file of the Android library module folder comprises a configuration entry configuration file and a packaging configuration file; the first parameter writing unit is used for writing the compiled SDK version number and the packaging construction tool version number into a configuration entry configuration file and a packaging configuration file of each Android library module folder in a dynamic mode; and the second parameter writing unit is used for writing the dependent parameters required by each simulated Android library module into the configuration entry configuration file and the packaging configuration file of each Android library module folder in a static form.
Further, the dependency relationship establishment module 50 includes: the first parameter acquisition unit is used for acquiring the package name and the root directory entry parameter of each simulated Android library module; the first dependency relation establishing unit is used for adding the package name of each simulated Android library module into the configuration file of the main project, and establishing the dependency relation between the newly generated Android library module and the main project; the second parameter acquisition unit is used for acquiring the dependent item parameters of the second configuration file in the Android application development module; and the second dependency relation establishing unit is used for adding the root directory entry parameter of each simulated Android library module into the dependency item parameter and establishing the dependency relation between each simulated Android library module and the Android application development module.
Further, the method further comprises the following steps: and the compiling and packing module is used for compiling and packing each simulated Android library module with the dependency relationship to obtain each application apk package, wherein the application apk package is used for realizing the reference of the simulated Android library module by the Android application development module and the main engineering.
Further, the method further comprises the following steps:
the configuration content template acquisition module is used for acquiring configuration content templates corresponding to the first configuration files of each Android library module folder;
and the configuration content writing module is used for writing the acquired configuration content templates into the first configuration files of each Android library module folder.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application. As shown in fig. 5, the present application provides an electronic device including: a memory 601 for storing program instructions; the processor 602 is configured to call and execute the program instructions in the memory, so as to implement the method for creating the Android library module dependency in application development described in the foregoing embodiment.
In this embodiment, the processor 602 and the memory 601 may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present application. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
The application provides a storage medium, wherein a computer program is stored in the storage medium, and when at least one processor of an apparatus for creating an Android library module dependency in application program development executes the computer program, the apparatus for creating an Android library module dependency in application program development executes the method for creating an Android library module dependency in application program development described in the previous embodiment.
The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
It will be apparent to those skilled in the art that the techniques of embodiments of the present application may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present application.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the device embodiment for creating the Android library module dependency relationship in the application program development, the description is relatively simple because it is basically similar to the method embodiment, and the relevant points are just referred to the description in the method embodiment.
The embodiments of the present invention described above do not limit the scope of the present invention.

Claims (9)

1. The method for creating the Android library module dependency relationship in the application program development is characterized by comprising the following steps of:
creating an Android library module folder for each first configuration file of an Android library module to be created under the root directory of an Android application development module, wherein the first configuration files are extracted by decompression in an AAR file of an application program;
extracting dynamic configuration parameters of the Android application development module from a second configuration file of the Android application development module of the application program, wherein the dynamic configuration parameters are parameters for keeping version numbers of the Android application development module and the Android library module consistent;
obtaining the dependent parameters required by each Android library module, wherein the dependent parameters are parameters used for establishing dependence of the Android library module and the Android application development module;
Writing the dynamic configuration parameters and each dependent parameter into the first configuration file of each Android library module folder respectively so as to simulate each Android library module;
and respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module.
2. The method of claim 1, wherein the first profile is the same ID designation as the other profiles when incorporated into the profile of the main project of the application.
3. The method according to claim 1 or 2, wherein writing the dynamic configuration parameters and each of the dependent parameters into the first configuration file of each Android library module folder, respectively, comprises:
the dynamic configuration parameters comprise a compiling SDK version number and a packaging construction tool version number, and the first configuration file of the Android library module folder comprises a configuration entry configuration file and a packaging configuration file;
writing the compiled SDK version number and the packaging construction tool version number into a configuration entry configuration file and a packaging configuration file of each Android library module folder in a dynamic mode;
And writing the dependent parameters required by each Android library module into the configuration inlet configuration file and the packaging configuration file of each Android library module folder in a static form.
4. The method according to claim 1, wherein adding the first profile of each simulated Android library module to the profile of the main project and the second profile of the Android application development module, respectively, comprises:
acquiring package names and root directory entry parameters of each simulated Android library module;
adding the package name of each simulated Android library module into the configuration file of the main project, and establishing the dependency relationship between each simulated Android library module and the main project;
acquiring dependent item parameters of the second configuration file in the Android application development module;
and adding the root directory entry parameter of each simulated Android library module into the dependency item parameter, and establishing the dependency relationship between each simulated Android library module and the Android application development module.
5. The method of claim 1, wherein extracting the dynamic configuration parameters of the Android application development module from the second configuration file of the Android application development module of the application program comprises:
Acquiring a second configuration file of an Android application development module of the application program, wherein the second configuration file comprises dynamic configuration parameters and a root directory of the Android application development module;
and extracting dynamic configuration parameters of the Android application development module from the second configuration file.
6. The method of claim 1, further comprising, after writing the dynamic configuration parameters into the first configuration file of each of the Android library module folders:
acquiring configuration content templates corresponding to the first configuration files of each Android library module folder;
and writing the obtained configuration content templates into the first configuration files of each Android library module folder.
7. An apparatus for creating Android library module dependencies in application development, comprising:
the Android application development module is used for creating an Android library module folder for each first configuration file of the Android library module to be created under the root directory of the Android application development module, wherein the first configuration files are extracted by decompression of the AAR files of the application program;
The configuration file acquisition module is used for extracting dynamic configuration parameters of the Android application development module from a second configuration file of the Android application development module of the application program, wherein the dynamic configuration parameters are parameters for keeping the version numbers of the Android application development module and the Android library module consistent;
the dependent parameter acquisition module is used for acquiring the dependent parameters required by each Android library module, wherein the dependent parameters are parameters used for establishing dependence of the Android library modules and the Android application development modules;
the parameter writing module is used for writing the dynamic configuration parameters and each dependent parameter into the first configuration file of each Android library module folder respectively so as to simulate each Android library module;
and the dependency relation establishing module is used for respectively adding the first configuration file of each simulated Android library module into the configuration file of the main project and the second configuration file of the Android application development module.
8. An electronic device, comprising:
a memory for storing program instructions;
the processor is configured to call and execute the program instructions in the memory, so as to implement the method for creating Android library module dependencies in application program development according to any one of claims 1 to 6.
9. A storage medium, wherein a computer program is stored in the storage medium, and when the computer program is executed by at least one processor of an apparatus for creating an Android library module dependency in an application program development, the apparatus for creating an Android library module dependency in an application program development executes the method for creating an Android library module dependency in an application program development according to any one of claims 1 to 6.
CN202011350207.3A 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application program development Active CN112328241B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011350207.3A CN112328241B (en) 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application program development

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010183863.2A CN111367512B (en) 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application development
CN202011350207.3A CN112328241B (en) 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application program development

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202010183863.2A Division CN111367512B (en) 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application development

Publications (2)

Publication Number Publication Date
CN112328241A CN112328241A (en) 2021-02-05
CN112328241B true CN112328241B (en) 2023-12-12

Family

ID=71208862

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202011350207.3A Active CN112328241B (en) 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application program development
CN202010183863.2A Active CN111367512B (en) 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application development

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202010183863.2A Active CN111367512B (en) 2020-03-16 2020-03-16 Method and device for creating Android library module dependency relationship in application development

Country Status (1)

Country Link
CN (2) CN112328241B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076146A (en) * 2021-03-09 2021-07-06 北京一亩田新农网络科技有限公司 Dynamic APK loading method, device, system and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528258A (en) * 2016-10-28 2017-03-22 武汉斗鱼网络科技有限公司 Method and system for improving compiling speed of Android project
WO2018028027A1 (en) * 2016-08-12 2018-02-15 北京大学 Method for opening up data and functions of terminal application based on reconstruction technology
CN110389762A (en) * 2018-04-19 2019-10-29 北京京东尚科信息技术有限公司 The method and apparatus of AAR packet are handled in Android engineering
CN110502222A (en) * 2019-07-23 2019-11-26 北京字节跳动网络技术有限公司 AAR method, apparatus, medium and the equipment in outgoing dependence inner base library
CN110554876A (en) * 2018-05-31 2019-12-10 北京京东尚科信息技术有限公司 Method and device for compiling android project

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7765520B2 (en) * 2004-05-21 2010-07-27 Bea Systems, Inc. System and method for managing cross project dependencies at development time
US8266588B2 (en) * 2007-11-12 2012-09-11 International Business Machines Corporation Creating projects in a rational application developer workspace
CN103176838A (en) * 2011-12-22 2013-06-26 盛乐信息技术(上海)有限公司 Method and system compatible with Android native program
CN109144521A (en) * 2018-09-28 2019-01-04 五八有限公司 Generate method, apparatus, computer equipment and the readable storage medium storing program for executing of static library

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018028027A1 (en) * 2016-08-12 2018-02-15 北京大学 Method for opening up data and functions of terminal application based on reconstruction technology
CN106528258A (en) * 2016-10-28 2017-03-22 武汉斗鱼网络科技有限公司 Method and system for improving compiling speed of Android project
CN110389762A (en) * 2018-04-19 2019-10-29 北京京东尚科信息技术有限公司 The method and apparatus of AAR packet are handled in Android engineering
CN110554876A (en) * 2018-05-31 2019-12-10 北京京东尚科信息技术有限公司 Method and device for compiling android project
CN110502222A (en) * 2019-07-23 2019-11-26 北京字节跳动网络技术有限公司 AAR method, apparatus, medium and the equipment in outgoing dependence inner base library

Also Published As

Publication number Publication date
CN111367512B (en) 2021-05-28
CN112328241A (en) 2021-02-05
CN111367512A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
CN109976761B (en) Software development kit generation method and device and terminal equipment
US20040098402A1 (en) System and method for common code generation
CN111367510B (en) Android function module development method and device
CN106775744B (en) Method and device for generating static library
CN109032631B (en) Application program patch package obtaining method and device, computer equipment and storage medium
CN110895471A (en) Installation package generation method, device, medium and electronic equipment
WO2023155940A1 (en) Mini program compiling method and apparatus, mini program running method and apparatus, and storage medium
CN111427583A (en) Component compiling method and device, electronic equipment and computer readable storage medium
CN110362792B (en) Method and device for converting RN file into applet file and conversion equipment
CN111290996A (en) Document format conversion method, device, equipment and readable storage medium
CN112328241B (en) Method and device for creating Android library module dependency relationship in application program development
CN111352631B (en) Interface compatibility detection method and device
CN114840195B (en) Privatization method for iOS SDK static library
CN110806891A (en) Method and device for generating software version of embedded equipment
CN115576560A (en) Hot reloading method, device, equipment and medium for dynamic loader
CN115629795A (en) Configuration method and device of executable file and electronic equipment
CN115291933A (en) Method, device and equipment for constructing small program data packet and storage medium
CN114579141A (en) Method and device for converting require frame into VUE frame
CN114816475A (en) Method, device, equipment and medium for updating embedded operating system
CN114201174A (en) Construction method and device of hybrid mobile application, electronic equipment and storage medium
CN112596734A (en) Static library generation method and device
CN115543440A (en) Method for migrating android project to android-like system, electronic equipment and storage medium
CN110716746B (en) Method and device for converting RN style code into applet style code
CN116774988B (en) Method and device for releasing frame package mode symbol dependence
CN114579135B (en) Installation package generation method and device

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