Engineering code packaging method, device and electronic device
By building an Android open source project environment, using Gradle plug-in to automatically obtain dependency packages and compile and package APK files, and combining make instructions to generate mirror files, it solves the problem of cumbersome compilation and packaging of engineering codes in the existing technology, and achieves a more efficient and convenient compilation and packaging process.
Patent Information
- Application Number
- CN202211215838.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-09-30
AI Technical Summary
In the prior art, the process of compiling and packaging engineering code into Android system mirroring is relatively cumbersome and requires manual configuration.
By building an Android open source project environment, downloading engineering code, and automatically obtaining dependency packages based on the Gradle plug-in, compiling and packaging the APK file. Then, use the make directive to find and compile the Android.mk file according to the storage path of the APK file to generate a mirror file.
It simplifies the compilation and packaging process of engineering code, reduces manual configuration steps, and improves compilation efficiency and convenience.
Smart Images

Figure CN115509560B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of source code compilation and packaging, and particularly relates to a method, device and electronic device for engineering code packaging. Background Art
[0002] The mirror image file of the Android system needs to be generated by compiling the source code. However, the application directory structure in the source code does not match the directory of the AndroidStudio project very well, and manual configuration is often required. Therefore, the process of compiling and packaging the current engineering code into the Android system mirror image is relatively cumbersome. Summary of the Invention
[0003] The purpose of the present invention is to provide a method, device and electronic device for engineering code packaging, so as to reduce the technical problem that it is relatively cumbersome to compile and package engineering code into the Android system mirror image existing in the prior art.
[0004] In a first aspect, an embodiment of the present invention provides a method for engineering code packaging, and the method includes:
[0005] Build an Android Open Source Project environment and download the engineering code;
[0006] Based on the position of the Android SDK toolkit source code found according to the engineering code and the dependency packages corresponding to the engineering code obtained based on the Gradle plugin, compile and package an APK file;
[0007] Search for and compile the Android.mk file configured with the storage path of the APK file according to the make instruction, and package and generate a mirror image file.
[0008] Combined with the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, wherein the step of based on the position of the Android SDK toolkit source code found according to the engineering code and the dependency packages corresponding to the engineering code obtained based on the Gradle plugin, compile and package an APK file includes:
[0009] Determine the position of the Android SDK toolkit source code according to the Android resource file created under the root directory of the engineering code, wherein the directory position of the Android SDK toolkit is configured in the Android resource file, and the Android SDK toolkit corresponds to the Android SDK toolkit source code;
[0010] Based on the Gradle command configured by the Gradle plugin, search for the build.gradle file from the source file directory of the engineering code, and download the dependency packages corresponding to the engineering code according to the dependency package corresponding path configured in the build.gradle file;
[0011] Compile and package an APK file according to the source code location of the Android SDK toolkit and the dependency packages corresponding to the project code.
[0012] Combined with the first aspect, the embodiment of the present invention provides a second possible implementation manner of the first aspect. Among them, the steps of searching for and compiling the Android.mk file configured with the storage path of the APK file according to the make instruction and packaging and generating an image file include:
[0013] Create an Android.mk file in the root directory of the project code, where the Android.mk file is configured with content representing the storage path of the APK file;
[0014] According to the Android.mk file created in the root directory of the project code and the make instruction, search for the Android.mk file in the root directory of the Android source code, and compile the Android.mk file in the root directory of the Android source code to package and generate an image file.
[0015] Combined with the first aspect, the embodiment of the present invention provides a third possible implementation manner of the first aspect. Among them, the method further includes:
[0016] Pre-install the image file into the in-vehicle device.
[0017] Combined with the first aspect, the embodiment of the present invention provides a fourth possible implementation manner of the first aspect. Among them, before the step of pre-installing the image file into the in-vehicle device, the method further includes:
[0018] Compare the preset target directory in the Android source code file with the image file;
[0019] If there are missing items that have not been packaged in the preset target directory, search for and compile the Android.mk file in the root directory of the project code according to the make instruction to update the image file.
[0020] Combined with the first aspect, the embodiment of the present invention provides a fifth possible implementation manner of the first aspect. Among them, the steps of building the Android open source project environment and downloading the project code include:
[0021] Download the Android source code file, JDK toolkit, Android SDK toolkit, Git terminal, and Gradle plugin;
[0022] Install the JDK toolkit, the Android SDK toolkit, and the Gradle plugin into the Linux system and configure the environment variables;
[0023] Download the project code according to the Git terminal and store it in the directory of the Android source code file.
[0024] Combined with the first aspect, the embodiment of the present invention provides a sixth possible implementation manner of the first aspect, wherein the method further includes:
[0025] Download the latest version of the project code according to the Git terminal;
[0026] Based on the source code location of the Android SDK toolkit found from the latest version of the project code and the dependency package corresponding to the latest version of the project code obtained based on the Gradle plugin, compile and package the latest version of the APK file;
[0027] According to the make instruction, search for and compile the Android.mk file configured with the storage path of the latest version of the APK file, and package and generate the latest version of the image file.
[0028] In a second aspect, the embodiment of the present invention further provides an apparatus for packaging project code, the apparatus includes:
[0029] A building module, which builds an Android open source project environment and downloads project code;
[0030] A compilation module, which based on the source code location of the Android SDK toolkit found from the project code and the dependency package corresponding to the project code obtained based on the Gradle plugin, compiles and packages an APK file;
[0031] A packaging module, which according to the make instruction, searches for and compiles the Android.mk file configured with the storage path of the APK file, and packages and generates an image file.
[0032] In a third aspect, an embodiment provides an electronic device, including a memory and a processor, wherein a computer program executable on the processor is stored in the memory, and when the processor executes the computer program, the steps of the method according to any one of the foregoing embodiments are implemented.
[0033] In a fourth aspect, an embodiment provides a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the steps of the method according to any one of the foregoing embodiments.
[0034] An embodiment of the present invention provides a method, device, and electronic device for engineering code packaging. First, an Android open-source project environment is set up, and the engineering code corresponding to the system application is downloaded. The source code location of the Android SDK toolkit can be obtained, and the dependency packages corresponding to the engineering code are automatically obtained and downloaded based on the Gradle plugin. Then, an APK file is compiled and packaged, and the make command is run to find the above-mentioned APK file according to the Android.mk file configured with the storage path of the APK file and compile and package it into an image file, enabling a relatively simple and fast compilation and packaging operation for the engineering code corresponding to the system application.
[0035] Other features and advantages of the present invention will be described in the following specification, and some of them will become obvious from the specification or be understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the specification and the drawings.
[0036] To make the above objectives, features, and advantages of the present invention more obvious and understandable, the following provides preferred embodiments in conjunction with the accompanying drawings and describes them in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0038] Figure 1 It is a flowchart of a method for engineering code packaging provided by an embodiment of the present invention;
[0039] Figure 2 It is a schematic diagram of the functional modules of a device for engineering code packaging provided by an embodiment of the present invention;
[0040] Figure 3 It is a schematic diagram of the hardware architecture of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0041] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the drawings. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0042] Currently, during the packaging process of engineering code, manually adding relevant dependency packages is required when compiling an APK using the Android.mk file provided by Android, which is a cumbersome operation. In addition, if the functional modules of the project engineering change, the configuration of the corresponding source files needs to be manually modified under the Android source code directory to achieve the purpose of updating the compilation configuration file, which is not very convenient for developers.
[0043] Based on this, an engineering code packaging method, device, and electronic device provided by an embodiment of the present invention can more simply and conveniently compile and package engineering code into an Android system image.
[0044] For ease of understanding of this embodiment, first, a detailed introduction to an engineering code packaging method disclosed by an embodiment of the present invention is provided. This method can be applied to a source code compilation and packaging platform or an intelligent control device with compilation and packaging capabilities.
[0045] Figure 1 It is a flowchart of an engineering code packaging method provided by an embodiment of the present invention.
[0046] Referring to Figure 1 , the method includes:
[0047] Step S102, build an Android Open Source Project environment and download the engineering code.
[0048] Among them, before the in-vehicle system application (Android system application) is compiled and packaged, it is necessary to first build an Android Open Source Project environment so that the Android system application file can be compiled. After the environment is built, the engineering code corresponding to the system application can be downloaded from the official website to participate in the subsequent compilation operation steps.
[0049] Step S104, based on the source code location of the Android SDK toolkit found from the engineering code and the dependency packages corresponding to the engineering code obtained based on the Gradle plugin, compile and package an APK file.
[0050] It should be noted that under the Android Open Source Project environment, the Android SDK toolkit and the Gradle plugin can be obtained to compile and package the engineering code of the system application. According to the characteristics of the Gradle plugin, each dependency package corresponding to the engineering code can be automatically obtained and packaged into an APK file, without the need for manual recording and acquisition of each dependency package corresponding to the engineering code by humans.
[0051] Among them, the Android SDK toolkit (Android SDK): is a software development toolkit for the mobile development platform launched by Google; the Gradle plugin: is an open-source tool for project automation build based on the concepts of Apache Ant and Apache Maven, mainly for Java applications.
[0052] Step S106, searching and compiling the Android.mk file configured with the storage path of the APK file according to the make instruction, and packaging and generating an image file.
[0053] The make command can also be obtained in the Android open source project environment. According to the path of the APK file generated in the previous steps, the APK file is searched and compiled, and packaged to generate an image file. Android.mk file: It is a small part of GNU Makefile, which is used to compile Android programs.
[0054] In a preferred embodiment of actual application, an Android open source project environment is first built, and the engineering code corresponding to the system application is downloaded. The source code location of the Android SDK toolkit can be obtained, and the dependency package corresponding to the engineering code is automatically obtained and downloaded based on the Gradle plug-in, and then an APK file is compiled and packaged. Then, the make instruction is run according to the Android.mk file configured with the storage path of the APK file, and the above APK file is searched and compiled and packaged into a mirror file, so that the system application corresponding engineering code can achieve a relatively simple and fast compilation and packaging operation.
[0055] In some embodiments, before compiling and packaging the engineering code of the system application, it is necessary to build an Android development source code project environment to ensure that the above compilation purpose can be achieved; illustratively, the above step S102 can be implemented in the following ways, specifically including:
[0056] Step 1.1), download the Android source code files, JDK toolkit, Android SDK toolkit, Git terminal and Gradle plug-in.
[0057] It should be mentioned that the Android Open Source Project (Android Open Source Project): full name "Android Open Source Project", initiated by Google, is mainly used for the system of mobile devices; Android source code files, JDK toolkit, Android SDK toolkit, Git terminal and Gradle plug-in can be downloaded from their respective official websites. Among them, the Android source code files are used to implement the basic functions of the system application; Git terminal: is an open source distributed version control system that can effectively and quickly handle the version management of small to very large projects. JDK: is a software development kit for the Java language, mainly used for Java applications on mobile devices and embedded devices. JDK is the core of the entire Java development, which includes the Java runtime environment (JVM+Java system class library) and JAVA tools.
[0058] Step 1.2), install the JDK toolkit, the Android SDK toolkit, and the Gradle plugin into the Linux system, and configure the environment variables to enable subsequent compilation and packaging operations.
[0059] Among them, the configuration of the environment variables is for the quick application of the above tools and the improvement of compatibility.
[0060] Step 1.3), download the project code according to the Git terminal and store it in the directory of the Android source code file.
[0061] Among them, the Git terminal can provide the target address of the project code, so as to download the Gitlab project code according to the target address and store the Gitlab project code corresponding to the system application in the directory of the Android source code file.
[0062] It should be noted that in some other embodiments, Step 1.3) can also be executed first, and then Step 1.1)-Step 1.2) are executed. The execution order is not limited here; the execution orders of these two steps are both for building the Android development source code project environment.
[0063] In some embodiments, the project code corresponds to multiple dependency packages, and developers need to manually configure the path and download location of each dependency package to the file directory, which is rather cumbersome; through research by the inventor, it is found that the dependency packages corresponding to the project code can be automatically called according to the characteristics of the Gradle plugin, achieving the purpose of simply and quickly compiling and packaging the project code; exemplarily, Step S104 in the above embodiment can also be implemented through the following steps, including:
[0064] Step 2.1), determine the source code location of the Android SDK toolkit according to the Android resource file (local.properties file) created under the root directory of the project code.
[0065] Among them, the Android SDK toolkit directory location is configured in the Android resource file (local.properties file). Since the Android SDK toolkit and the Android SDK toolkit source code are in one-to-one correspondence, the storage location of the Android SDK toolkit source code can be determined according to this Android resource file.
[0066] Step 2.2), based on the Gradle command configured by the Gradle plugin, find the build.gradle file from the source file (Src) directory of the project code, and download the dependency packages corresponding to the project code according to the dependency package corresponding paths configured in the build.gradle file.
[0067] Among them, in the above-mentioned step of installing the Gradle plugin on the Linux system, the configuration of the Gradle command can be realized at the same time. Based on the Gradle command, the build.gradle file is searched, and then each dependency package corresponding to the project code and the download path of each dependency package can be automatically obtained. Using Gradle to compile the project can automatically download the relevant dependency packages of the project code, and there is no need to manually import and configure the dependency packages.
[0068] Step 2.3), according to the source code location of the Android SDK toolkit and the dependency packages corresponding to the project code, compile and package to generate an APK file.
[0069] Here, in order to realize subsequent fast compilation and packaging operations, according to the source code location of the Android SDK toolkit obtained in the previous step, the Android SDK toolkit source code is searched, and then based on each dependency package downloaded corresponding to the project code, an APK file is packaged and generated; Exemplarily, the APK file can be stored in the project code directory.
[0070] In some embodiments, the compilation and packaging process can be further simplified by ignoring the impact of source file changes on the packaging of the APK file; Exemplarily, the aforementioned step S106 includes:
[0071] Step 3.1), create an Android.mk file in the root directory of the project code.
[0072] Among them, the content of LOCAL_SRC_FILES is configured in the Android.mk file, and the content of LOCAL_SRC_FILES can represent the storage path of the APK file.
[0073] Step 3.2), according to the Android.mk file created in the root directory of the project code and the make instruction, search for the Android.mk file in the root directory of the Android source code, and compile the Android.mk file in the root directory of the Android source code to generate an image file.
[0074] Among them, the make command can be used to compile the source code of the integration system. In fact, the make command executes the Makefile. That is, when the Android system executes the make command, it specifically means executing the Makefile in the root directory of the Android source code. This file will search for the Android.mk file in the root directory of each project code in the Android source code directory. Based on this Android.mk file, the Apk file is found, and then the Apk file is compiled in sequence. After execution, image files will be generated in the directory ~ / android / src / out / target / product / generic. The image files include ramdisk.img, system.img, and userdata.img files.
[0075] In some embodiments, the image files generated in the foregoing embodiments can be applied to the pre-installation scenario of the in-vehicle device for vehicle applications. The method further includes:
[0076] Step 4.1), pre-install the image file into the in-vehicle device; the image file compiled and packaged in this way reduces the configuration of the dependent packages and source files of Android.mk, and can achieve the effect of quickly flashing and pre-installing into the in-vehicle device, helping the vehicle factory achieve a more efficient vehicle production purpose.
[0077] As a preferred embodiment, on the basis of the foregoing embodiments, if there are changes, modifications, or upgrades to the system application, the corresponding source files will also be modified accordingly. The embodiments of the present invention achieve the quick and convenient effect of compilation and packaging by ignoring the changes in the source files and focusing on the overall packaging generation of the APK. Among them, the method further includes:
[0078] Step 5.1), download the latest version of the project code according to the Git terminal.
[0079] It can be understood that if there are changes in the source files, the Git terminal will correspondingly have the latest version of the project code, download it, and implement the subsequent steps 5.2)-step 5.3) based on the latest version of the project code to achieve the compilation of the latest version of the APK file and the packaging of the latest version of the image file.
[0080] Step 5.2), find the source code location of the Android SDK toolkit based on the latest version of the project code and obtain the dependent packages corresponding to the latest version of the project code based on the Gradle plugin, and compile and package the latest version of the APK file.
[0081] Step 5.3), search for and compile the Android.mk file configured with the storage path of the latest version of the APK file according to the make command, and package and generate the latest version of the image file.
[0082] It should be noted that the compilation and packaging method provided in this application obtains the latest version of the engineering code by focusing on obtaining the latest version of the APK file path, and then packages and generates the latest version of the image file without considering the complex changes of its source files. This saves developers a lot of configuration and source file modification operations, and the compilation and packaging efficiency is higher.
[0083] In some embodiments, in order to further improve the reliability and efficiency of the vehicle machine pre-installation of the image file, before step 4.1), the aforementioned method further includes:
[0084] Step 6.1), compare the preset target directory under the Android source code file with the image file.
[0085] Among them, the preset target directory stored under the Android source code file generally records the functional modules and files that the image file needs to have. By comparing the image file generated by the aforementioned embodiment with the preset target, it can be determined whether the image file is missing.
[0086] Step 6.2), if there are any unpackaged missing items in the preset target directory, search and compile the Android.mk file in the root directory of the project code according to the make command to update the image file.
[0087] It should be noted that the make command actually executes the Makefile file. If no Makefile is specified, the make command will execute the Makefile file in the current path; if there are missing items in the preset target directory that are not packaged in the current image file, the make command is controlled to execute the Android.mk file in the root directory of the project code, and the image file is regenerated to supplement the missing items, so as to update the image file. Preferably, the updated image file can also be controlled to execute the judgment of step 5.1) again to ensure the reliability of the image file pre-installed in the car computer, and avoid the defect that the image file that reaches the pre-installation stage needs to be loaded repeatedly, thereby reducing the efficiency of flashing pre-installation.
[0088] The embodiment of the present invention is applicable to compiling any Android system source code AndroidStudio project code into the system, automatically downloading the project source code of the specified Gitlab warehouse, using the Gradle plug-in to automatically call the dependency package to compile an APK file, and compiling the APK file into a mirror file by searching the storage path of the APK file. By reducing the configuration of the dependent packages and source files of Android.mk, the project project code configuration steps for compiling the Android system source code are simplified, and the compilation efficiency is improved.
[0089] like Figure 2As shown in the figure, an embodiment of the present invention provides an engineering code packaging device, and the device includes:
[0090] A building module that builds an Android open source project environment and downloads engineering code;
[0091] A compilation module that, based on the source code location of the Android SDK toolkit found from the engineering code and the dependency packages corresponding to the engineering code obtained based on the Gradle plugin, compiles and packages an APK file;
[0092] A packaging module that searches for and compiles an Android.mk file configured with the storage path of the APK file according to the make instruction, and packages and generates an image file.
[0093] In some embodiments, the compilation module is further specifically configured to determine the source code location of the Android SDK toolkit according to the Android resource file created under the root directory of the engineering code, where the directory location of the Android SDK toolkit is configured in the Android resource file, and the Android SDK toolkit corresponds to the source code of the Android SDK toolkit; based on the Gradle command configured by the Gradle plugin, search for the build.gradle file from the source file directory of the engineering code, and download the dependency packages corresponding to the engineering code according to the dependency package corresponding path configured in the build.gradle file; compile and package an APK file according to the source code location of the Android SDK toolkit and the dependency packages corresponding to the engineering code.
[0094] In combination with the first aspect, the packaging module is further specifically configured to create an Android.mk file under the root directory of the engineering code, where the content representing the storage path of the APK file is configured in the Android.mk file; according to the Android.mk file created under the root directory of the engineering code and the make instruction, search for the Android.mk file under the root directory of the Android source code, and compile the Android.mk file under the root directory of the Android source code to package and generate an image file.
[0095] In some embodiments, the device further includes a pre-installation module for pre-installing the image file into the in-vehicle device.
[0096] In some embodiments, the device further includes an update module, and before the step of pre-installing the image file into the in-vehicle device, the update module is further specifically configured to compare a preset target directory under the Android source code file with the image file; if there are missing items that have not been packaged in the preset target directory, search for and compile the Android.mk file under the root directory of the engineering code according to the make instruction to update the image file.
[0097] In some embodiments, the building module is further specifically configured to download Android source code files, JDK toolkits, Android SDK toolkits, Git terminals, and Gradle plugins; install the JDK toolkit, the Android SDK toolkit, and the Gradle plugin into the Linux system and configure environment variables; download project codes according to the Git terminal and store them in the directory of the Android source code files.
[0098] In some embodiments, the updating module is further specifically configured to download the latest version of project codes according to the Git terminal; find the source code location of the Android SDK toolkit based on the latest version of project codes and obtain the dependency packages corresponding to the latest version of project codes based on the Gradle plugin, and compile and package to generate the latest version of APK files; find and compile the Android.mk file configured with the storage path of the latest version of APK files according to the make instruction, and package and generate the latest version of image files.
[0099] The embodiments of the present invention provide an electronic device for implementation. In this embodiment, the electronic device may be, but is not limited to, a computer device with analysis and processing capabilities such as a personal computer (PC), a laptop computer, a monitoring device, a server, etc.
[0100] As an exemplary embodiment, reference may be made to Figure 3 , the electronic device 110 includes a communication interface 111, a processor 112, a memory 113, and a bus 114. The processor 112, the communication interface 111, and the memory 113 are connected through the bus 114; the above-mentioned memory 113 is used to store a computer program that supports the processor 112 to execute the above-mentioned method, and the above-mentioned processor 112 is configured to execute the program stored in the memory 113.
[0101] The machine-readable storage medium mentioned in this article may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.
[0102] The non-volatile medium may be non-volatile memory, flash memory, storage drives (such as hard disk drives), any type of storage disk (such as optical discs, DVDs, etc.), or similar non-volatile storage media, or a combination thereof.
[0103] It can be understood that the specific operation methods of the functional modules in this embodiment can refer to the detailed descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.
[0104] The computer-readable storage medium provided by the embodiment of the present invention stores a computer program, and when the computer program code is executed, the method described in any of the above embodiments can be implemented. For the specific implementation, reference can be made to the method embodiments and will not be elaborated here.
[0105] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments and will not be repeated here.
[0106] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "install", "connect", and "couple" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0107] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0108] Finally, it should be noted that the above embodiments are only specific implementation manners of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting it. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements for some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered by the protection scope of the present invention.
Claims
1. An engineering code packaging method, characterized in that, the method includes: Set up an Android open source project environment and download the engineering code; Based on the source code location of the Android SDK toolkit found from the engineering code and the dependency packages corresponding to the engineering code obtained based on the Gradle plugin, compile and package to generate an APK file; According to the make instruction, search for and compile the Android.mk file configured with the storage path of the APK file, and package and generate an image file; The step of compiling and packaging an APK file based on the source code location of the Android SDK toolkit found from the engineering code and the dependency packages corresponding to the engineering code obtained based on the Gradle plugin includes: Determine the source code location of the Android SDK toolkit according to the Android resource file created under the root directory of the engineering code, wherein the directory location of the Android SDK toolkit is configured in the Android resource file, and the Android SDK toolkit corresponds to the source code of the Android SDK toolkit; Based on the Gradle command configured by the Gradle plugin, search for the build.gradle file from the source file directory of the engineering code, and download the dependency packages corresponding to the engineering code according to the dependency package corresponding path configured in the build.gradle file; Compile and package an APK file according to the source code location of the Android SDK toolkit and the dependency packages corresponding to the engineering code; The step of searching for and compiling the Android.mk file configured with the storage path of the APK file according to the make instruction and packaging and generating an image file includes: Create an Android.mk file under the root directory of the engineering code, wherein the content representing the storage path of the APK file is configured in the Android.mk file; According to the Android.mk file created under the root directory of the engineering code and the make instruction, search for the Android.mk file under the root directory of the Android source code and compile the Android.mk file under the root directory of the Android source code to package and generate an image file.
2. The method according to claim 1, characterized in that, the method further includes: Pre-install the image file into the in-vehicle device.
3. The method according to claim 2, characterized in that, Before the step of pre-installing the image file into the in-vehicle device, the method further includes: Compare the preset target directory under the Android source code file with the image file; If there are missing items that have not been packaged in the preset target directory, search for and compile the Android.mk file under the root directory of the engineering code according to the make instruction to update the image file.
4. The method according to claim 1, characterized in that, The step of setting up an Android open source project environment and downloading the engineering code includes: Download the Android source code file, JDK toolkit, Android SDK toolkit, Git terminal and Gradle plugin; Install the JDK toolkit, the Android SDK toolkit, and the Gradle plugin into the Linux system and configure the environment variables. Download the project code according to the Git terminal and store it in the directory of the Android source code file.
5. According to the method described in claim 1, characterized in that, the method further includes: Download the latest version of the project code according to the Git terminal; Based on the source code location of the Android SDK toolkit found from the latest version of the project code and the dependency packages corresponding to the latest version of the project code obtained based on the Gradle plugin, compile and package the latest version of the APK file; According to the make instruction, search for and compile the Android.mk file configured with the storage path of the latest version of the APK file, and package and generate the latest version of the image file.
6. An apparatus for packaging project code, characterized in that, the apparatus includes: A building module that builds an Android Open Source Project environment and downloads project code; A compilation module that, based on the source code location of the Android SDK toolkit found from the project code and the dependency packages corresponding to the project code obtained based on the Gradle plugin, compiles and packages an APK file; A packaging module that, according to the make instruction, searches for and compiles the Android.mk file configured with the storage path of the APK file, and packages and generates an image file; The compilation module is further configured to determine the source code location of the Android SDK toolkit according to the Android resource file created under the root directory of the project code, where the directory location of the Android SDK toolkit is configured in the Android resource file, and the Android SDK toolkit corresponds to the source code of the Android SDK toolkit; based on the Gradle command configured by the Gradle plugin, search for the build.gradle file from the source file directory of the project code, and download the dependency packages corresponding to the project code according to the dependency package corresponding path configured in the build.gradle file; compile and package the APK file according to the source code location of the Android SDK toolkit and the dependency packages corresponding to the project code; The packaging module is further configured to create an Android.mk file under the root directory of the project code, where the Android.mk file is configured with content representing the storage path of the APK file; according to the Android.mk file created under the root directory of the project code and the make instruction, search for the Android.mk file under the root directory of the Android source code and compile the Android.mk file under the root directory of the Android source code to package and generate an image file.
7. An electronic device, characterized in that, It includes a memory, a processor, and a program stored on the memory and capable of running on the processor. When the processor executes the program, it implements the method described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The readable storage medium stores a computer program, and when the computer program is executed, the method described in any one of claims 1-5 is implemented.
Citation Information
Patent Citations
A method and apparatus for Android plug-in development
CN109542445A
Assembly line construction method and device, electronic equipment and computer readable storage medium
CN114461182A