Method, device, storage medium and electronic device for generating installation package

By detecting the association relationship between XML layout files and control classes, ensuring that all class identities exist in the class collection, solving the problem of control class reference exceptions, improving the reliability of installation package generation and the stability of software applications.

CN111831292BActive Publication Date: 2025-01-14BEIJING XIAOMI PINECONE ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010623900.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2025-01-14
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

During the software development process, the reference exception of the control class in the XML layout file leads to poor reliability of installation package generation and is difficult to repair online.

Method used

By detecting the association relationship between layout files and control classes in the target document, ensure that all class identities are included in the class collection, the installation package is generated, and if an exception is found, the processing will be stopped and the prompt information will be output.

Benefits of technology

Improves the reliability of installation package generation, avoids control class reference exceptions, and enhances the stability and repairability of software applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111831292B_ABST
    Figure CN111831292B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device, storage medium and electronic device for generating an installation package, the method comprising: in the process of packaging a target application project, detecting the file identifier of each layout file recorded in the target document generated in the process and the class identifier of the target control class referenced by each layout file to obtain association information, the association information is used to characterize the association relationship between the file identifier and the class identifier; detecting whether all class identifiers in the association information are included in a class set, the class set includes the class identifiers of all control classes included in the target application project; if it is determined that all class identifiers are included in the class set, continuing to execute the process to generate an installation package for the target application project. The control class referenced by the layout file can be detected in the process of generating the installation package, avoiding abnormal control class references and improving the reliability of the generated installation package.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of software development, and in particular to a method, device, storage medium and electronic device for generating an installation package. Background Art

[0002] Compiling and packaging the code of software application projects and generating installation packages is an important part of software development based on Android, IOS or Windows platforms. In these software development processes, it is usually necessary to introduce markup language to design the layout of the interactive interface of the software application. Taking software development based on the Android platform as an example, the layout of the software application interface is usually designed using XML (Extensible Markup Language) files in the application project. The XML layout file contains one or more control classes, which are used to implement the functions contained in the software application interface. The control classes required for the development process include native controls provided by the Android platform, as well as control classes customized by developers based on functional requirements. These control class names are all written as tags in the XML layout file. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the present disclosure provides a method, device, storage medium and electronic device for generating an installation package.

[0004] According to a first aspect of an embodiment of the present disclosure, a method for generating an installation package is provided, the method comprising:

[0005] In the process of packaging the target application project, the file identifier of each layout file recorded in the target document generated in the process and the class identifier of the target control class referenced by each layout file are detected to obtain association relationship information, wherein the association relationship information is used to characterize the association relationship between the file identifier and the class identifier;

[0006] Detecting whether all class identifiers in the association relationship information are included in a class set, wherein the class set includes class identifiers of all control classes included in the target application project;

[0007] When it is determined that all the class identifiers are included in the class set, the processing is continued to generate an installation package for the target application project.

[0008] Optionally, after detecting whether all class identifiers in the association relationship information are included in the class set, the method further includes:

[0009] When it is determined that there is a target class identifier in the association relationship information that is not included in the class set, the processing process is stopped and a prompt message is output; wherein the prompt message includes: each of the target class identifiers in the association relationship information, and the file identifier of each target layout file, and the class identifier of the target control class referenced by the target layout file is the target class identifier.

[0010] Optionally, in the process of packaging the target application project, detecting the file identifier of each layout file recorded in the target document generated in the process and the class identifier of the target control class referenced by each layout file to obtain the association relationship information includes:

[0011] Execute the processing by using a preset packaging tool until the target document is generated;

[0012] Reading the target document through a preset task plug-in to determine the file identifier of each layout file in the target document, the class identifier of the target control class, and the reference relationship between each layout file and the target control class;

[0013] According to the reference relationship, the file identifier of each layout file and the class identifier of the target control class are stored in the form of a key-value pair as the association relationship information.

[0014] Optionally, the detecting whether all class identifiers in the association relationship information are included in the class set includes:

[0015] Searching the target application project by using a preset bytecode operation tool to determine all the control classes;

[0016] Cache the class identifiers of all the control classes into the target container to obtain the class set;

[0017] Each class identifier in the association relationship information is matched with the class set to determine whether all class identifiers in the association relationship information are included in the class set.

[0018] According to a second aspect of an embodiment of the present disclosure, a device for generating an installation package is provided, the device comprising:

[0019] An information determination module is configured to detect, during a process of packaging a target application project, a file identifier of each layout file recorded in a target document generated during the process and a class identifier of a target control class referenced by each layout file, so as to obtain association relationship information, wherein the association relationship information is used to characterize an association relationship between the file identifier and the class identifier;

[0020] an identification detection module, configured to detect whether all class identifications in the association relationship information are included in a class set, wherein the class set includes class identifications of all control classes included in the target application project;

[0021] The installation package generation module is configured to continue executing the processing to generate an installation package for the target application project when it is determined that all the class identifiers are included in the class set.

[0022] Optionally, the device further comprises:

[0023] A prompt output module is configured to stop the processing and output prompt information when it is determined that there is a target class identifier in the association relationship information that is not included in the class set; wherein the prompt information includes: each of the target class identifiers in the association relationship information, and the file identifier of each target layout file, and the class identifier of the target control class referenced by the target layout file is the target class identifier.

[0024] Optionally, the information determination module is configured to:

[0025] Execute the processing by using a preset packaging tool until the target document is generated;

[0026] Reading the target document through a preset task plug-in to determine the file identifier of each layout file in the target document, the class identifier of the target control class, and the reference relationship between each layout file and the target control class;

[0027] According to the reference relationship, the file identifier of each layout file and the class identifier of the target control class are stored in the form of a key-value pair as the association relationship information.

[0028] Optionally, the identification detection module is configured to:

[0029] Searching the target application project by using a preset bytecode operation tool to determine all the control classes;

[0030] Cache the class identifiers of all the control classes into the target container to obtain the class set;

[0031] Each class identifier in the association relationship information is matched with the class set to determine whether all class identifiers in the association relationship information are included in the class set.

[0032] According to a third aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the method for generating an installation package provided in the first aspect of the present disclosure are implemented.

[0033] According to a fourth aspect of an embodiment of the present disclosure, a mobile terminal is provided, comprising: the device for generating an installation package provided by the second aspect of the present disclosure.

[0034] The technical solution provided by the embodiment of the present disclosure can detect the file identifier of each layout file recorded in the target document generated in the process of packaging the target application project and the class identifier of the target control class referenced by each layout file to obtain association information, which is used to characterize the association between the file identifier and the class identifier; detect whether all class identifiers in the association information are included in the class set, and the class set includes the class identifiers of all control classes included in the target application project; if it is determined that all class identifiers are included in the class set, continue to execute the processing to generate the installation package of the target application project. The control class referenced by the layout file can be detected in the process of generating the installation package, avoiding the abnormal situation of the layout file referencing the control class, and improving the reliability of the generated installation package.

[0035] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0037] Figure 1 is a flowchart of a method for generating an installation package according to an exemplary embodiment;

[0038] Figure 2 is based on Figure 1 A flowchart of another method for generating an installation package is shown;

[0039] Figure 3 is based on Figure 2 A flowchart of a method for determining association relationship information is shown;

[0040] Figure 4 is based on Figure 2 A flow chart of a method for detecting class identification is shown;

[0041] Figure 5 is a block diagram of a device for generating an installation package according to an exemplary embodiment;

[0042] Figure 6 is based on Figure 5 A block diagram of another device for generating an installation package is shown;

[0043] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0044] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0045] In the related technology of software application development based on markup languages ​​such as XML, when the path of the custom control class has changed, or the tag of the control class filled in the XML layout file is incorrect, the compilation and packaging of the software application project can still be carried out, thereby generating an APK (Android application package) installation package of the application. However, since the control class corresponding to the tag in the XML layout file cannot be identified and applied, the reliability of the installation package generated in the above structure is poor. This poor reliability is reflected in that when the terminal system runs the installation package or executes a function of the application after the installation package is installed, it is unable to identify and reference the control class corresponding to the function through the tag in the XML layout file, resulting in the application being unable to be installed normally, or a crash exception occurs during the application operation. Moreover, once an application with a control class reference exception is released, it is difficult to repair it online.

[0046] Figure 1 is a flowchart of a method for generating an installation package according to an exemplary embodiment. Figure 1 As shown, the method comprises the following steps:

[0047] In step 101, during the process of packaging the target application project, the file identifier of each layout file recorded in the target document generated during the process and the class identifier of the target control class referenced by each layout file are detected to obtain association relationship information.

[0048] The association relationship information is used to characterize the association relationship between the file identifier and the class identifier.

[0049] The disclosed embodiment takes the target application project as a software application project based on the Android platform as an example to illustrate the above method for generating an installation package. Specifically, the processing process is a process of packaging the Java code of the target application project and finally generating an APK file (and the above installation package) through the AAPT (Android Asset Packaging Tool) and gradle (an open source tool for automated project construction) scripts in the SDK (Software Development Kit) provided by the Android platform. APK is the application package file format used by Android. The APK file contains compiled code files (.dex files), file resources (resources), native resource files (assets), certificates (certificates) and manifest files (manifest file). The layout file is an XML file, and the target control class is a native control class provided by the Android platform referenced by the XML file or a control class customized by the developer. The specific reference method is to add the reference path of the control class as an XML tag to the XML file. The file identifier of the layout file can be the file name, and the class identifier of the target control class (and the following control classes) can be a reference path containing the class name of the control class. For example, for the control class with class name A required by the application item "xxx", the class identifier of the control class can be expressed as com.xxx.A.

[0050] For example, during the execution of the above-mentioned AAPT, the class files and resource files (including XML layout files) in the application project will be processed first, and a text document named aapt_rules.txt will be generated in the specified directory of the target application project. The aapt_rules.txt document is the above-mentioned target document, which records the file information of all XML files and the class information of all control classes declared in the XML files. In addition, since the target document is a Java runtime file, the target document also includes other information such as the execution information required to perform the Java runtime keep operation. In this step 101, it is necessary to determine the reference relationship between the layout file and the target control class it references based on all the information provided by the target document, and generate association relationship information for recording this reference relationship.

[0051] In step 102, it is detected whether all class identifiers in the association relationship information are included in the class set.

[0052] The class set includes class identifiers of all control classes included in the target application project.

[0053] In step 103, when it is determined that all the above class identifiers are included in the class set, the processing is continued to generate an installation package of the target application project.

[0054] For example, the class set is a set of class identifiers generated by searching all Java files of the target application project. If a class identifier recorded in the association information does not exist in this class set, it means that the class identifier (actually the reference path of the control class A) has changed or the class identifier label in the layout file is incorrect. If it is determined that all class identifiers recorded in the association information exist in this class set, it is determined that the target control class declared in the layout file can be referenced normally, and then the processing is continued in step 103.

[0055] In one embodiment of the present disclosure, the processing can be understood as including two other parts, namely, the execution process of AAPT and the execution process of the gradle script. The execution process of the gradle script includes: compiling the Java code file of the target application project into a .class file through the task control and then converting it into a .dex file contained in the APK. It should be noted that after the execution process of AAPT is completed, the target document can be obtained, and after determining in step 103 that all the above class identifiers are included in the class set, the execution process of the gradle script can continue to be executed, thereby generating the APK file of the target application project.

[0056] In summary, the technical solution provided by the embodiments of the present disclosure can detect the file identifier of each layout file recorded in the target document generated during the processing of packaging the target application project and the class identifier of the target control class referenced by each layout file to obtain association information, which is used to characterize the association between the file identifier and the class identifier; detect whether all class identifiers in the association information are included in the class set, and the class set includes the class identifiers of all control classes included in the target application project; if it is determined that all class identifiers are included in the class set, continue to execute the processing to generate the installation package of the target application project. The control class referenced by the layout file can be detected during the generation of the installation package to avoid abnormal control class references and improve the reliability of the generated installation package.

[0057] Figure 2 is based on Figure 1 A flowchart of another method for generating an installation package is shown, such as Figure 2 As shown, after the above step 102, the above method further includes:

[0058] In step 104, when it is determined that there is a target class identifier that is not included in the class set in the association relationship information, the processing is stopped and a prompt message is output.

[0059] The prompt information includes: each target class identifier in the association relationship information, and a file identifier of each target layout file, and the class identifier of the target control class referenced by the target layout file is the target class identifier.

[0060] For example, if there is a target class identifier that is not included in the class set in the above step 102, it is necessary to output a prompt message to the developer to prompt that the layout file has a reference exception. The reference exception may include: the reference path of the control class has changed, resulting in the abnormal situation that the control class cannot be queried according to the path declared in the layout file, and the abnormal situation that the control class cannot be found due to the writing error of the class identifier tag itself in the layout file. The prompt information needs to indicate that the above abnormal situation has occurred during the packaging process, and preferably, the prompt information needs to indicate which control classes and which layout files have the above abnormal situation. Specifically, step 104 may include: in the case of determining that there is a target class identifier that is not included in the class set in the association relationship information, stop the packaging process of the target application project (i.e., the processing process) and obtain all target class identifiers in the association relationship information; find out the file identifier corresponding to each target class identifier according to the association relationship information; output each target class identifier and its corresponding file identifier in the form of a key-value pair. In this way, the developer can adjust the abnormal layout file and control class according to the above prompt information. After receiving the application project file adjusted by the developer, the above step 103 may be continued to generate an APK file of the target application project.

[0061] Figure 3 is based on Figure 2 A flowchart of a method for determining association relationship information is shown, such as Figure 3 As shown, step 101 includes:

[0062] In step 1011, the processing is performed by a preset packaging tool until the target document is generated.

[0063] For example, since the following steps 1012 and 1013 are based on the target document, the expression "until the target document is generated" used in step 1011 can be understood as the execution process of the above-mentioned APPT is completed and the target document is obtained.

[0064] In step 1012, the target document is read by a preset task plug-in to determine the file identifier of each layout file in the target document, the class identifier of the target control class, and the reference relationship between each layout file and the target control class.

[0065] In step 1013, according to the reference relationship, the file identifier of each layout file and the class identifier of the target control class are stored in the form of a key-value pair as the association relationship information.

[0066] For example, the task plug-in is a pre-written task plug-in with a string matching function. The task plug-in removes some interference information in the target document through string matching (for example, other information such as the execution information required for the above-mentioned keep operation). In this way, the file identifier of each layout file and the class identifier of the target control class can be extracted. Afterwards, according to the reference relationship between the layout file and the target control class, these file identifiers and class identifiers are stored in the form of key-value pairs as the association relationship information. Specifically, the above-mentioned key-value pair form can be expressed as (key, value); wherein key is a key used to save the class identifier of the target control class; value is a value used to save the file identifier of the layout file. It should be noted that a layout file may reference multiple target control classes. In this case, the relationship between each target control class and the layout file needs to be stored as a key-value pair. For example, a layout file with a file identifier of A references three target control classes with class identifiers of a, b, and c. Then, after step 1013, in the association relationship information, the reference relationships between the file identifier A and the class identifiers a, b and c are stored as (a, A), (b, A) and (c, A).

[0067] Figure 4 is based on Figure 2 A flow chart of a method for detecting class identification is shown in FIG. Figure 4 As shown, step 102 includes:

[0068] In step 1021, the target application project is searched by a preset bytecode operation tool to determine all the above control classes.

[0069] In step 1022, the class identifiers of all the above control classes are cached to the target container to obtain the class set.

[0070] In step 1023, each class identifier in the association relationship information is matched with the class set to determine whether all class identifiers in the association relationship information are included in the class set.

[0071] For example, the bytecode operation tool is a Javassist class library, which contains a classPool class. The classPool class can read all Java files in the application project, and obtain the class information of all control classes in these Java files, and then cache the class identifiers in these class information into a container (i.e., the target container) inside the Javassist class library. After obtaining the above-mentioned class set, the matching process in step 1023 may include: comparing and matching the class identifier recorded in the key of each key-value pair in the association relationship information with all class identifiers in the class set. After traversing the key in each key-value pair in the association relationship information, it can be determined whether all class identifiers in the association relationship information are included in the class set.

[0072] In summary, the technical solution provided by the embodiments of the present disclosure can detect the file identifier of each layout file recorded in the target document generated during the processing of packaging the target application project and the class identifier of the target control class referenced by each layout file to obtain association information, which is used to characterize the association between the file identifier and the class identifier; detect whether all class identifiers in the association information are included in the class set, and the class set includes the class identifiers of all control classes included in the target application project; if it is determined that all class identifiers are included in the class set, continue to execute the processing to generate the installation package of the target application project. The control class referenced by the layout file can be detected during the generation of the installation package to avoid abnormal control class references and improve the reliability of the generated installation package.

[0073] Figure 5 is a block diagram of a device for generating an installation package according to an exemplary embodiment. Figure 5 As shown, the device 500 includes:

[0074] The information determination module 510 is configured to detect the file identifier of each layout file recorded in the target document generated during the processing of packaging the target application project and the class identifier of the target control class referenced by each layout file to obtain association relationship information, wherein the association relationship information is used to characterize the association relationship between the file identifier and the class identifier;

[0075] The identification detection module 520 is configured to detect whether all class identifications in the association relationship information are included in a class set, and the class set includes class identifications of all control classes included in the target application project;

[0076] The installation package generation module 530 is configured to continue executing the processing to generate an installation package for the target application project when it is determined that all the above class identifiers are included in the class set.

[0077] Figure 6 is based on Figure 5 A block diagram of another device for generating an installation package is shown, such as Figure 6 As shown, the device 500 further includes:

[0078] The prompt output module 540 is configured to stop the processing and output a prompt message when it is determined that there is a target class identifier in the association relationship information that is not included in the class set; wherein the prompt message includes: each target class identifier in the association relationship information, and the file identifier of each target layout file, and the class identifier of the target control class referenced by the target layout file is the target class identifier.

[0079] Optionally, the information determination module 510 is configured to:

[0080] The processing is performed by a preset packaging tool until the target document is generated;

[0081] The target document is read by a preset task plug-in to determine the file identifier of each layout file in the target document, the class identifier of the target control class, and the reference relationship between each layout file and the target control class;

[0082] According to the reference relationship, the file identifier of each layout file and the class identifier of the target control class are stored in the form of a key-value pair as the association relationship information.

[0083] Optionally, the identification detection module 520 is configured to:

[0084] The target application project is searched by a preset bytecode operation tool to determine all the above control classes;

[0085] Cache the class identifiers of all the above control classes into the target container to obtain the class collection;

[0086] Each class identifier in the association relationship information is matched with the class set to determine whether all class identifiers in the association relationship information are included in the class set.

[0087] In summary, the technical solution provided by the embodiments of the present disclosure can detect the file identifier of each layout file recorded in the target document generated in the process of packaging the target application project and the class identifier of the target control class referenced by each layout file to obtain association information, which is used to characterize the association between the file identifier and the class identifier; detect whether all class identifiers in the association information are included in the class set, which includes the class identifiers of all control classes included in the target application project; if it is determined that all class identifiers are included in the class set, continue to execute the processing to generate the installation package of the target application project. The control class referenced by the layout file can be detected in the process of generating the installation package, avoiding the abnormal situation of the layout file referencing the control class, and improving the reliability of the generated installation package.

[0088] Figure 7 700 is a block diagram of an electronic device according to an exemplary embodiment. The electronic device 700 may be, for example, a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0089] Reference Figure 7 , the electronic device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .

[0090] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method for generating an installation package. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.

[0091] The memory 704 is configured to store data of various control types to support operations on the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any control type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0092] The power component 706 provides power to the various components of the electronic device 700. The power component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 700.

[0093] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0094] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.

[0095] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0096] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0097] The communication component 716 is configured to facilitate wired or wireless communication between the electronic device 700 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0098] In an exemplary embodiment, the electronic device 700 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned method of generating an installation package.

[0099] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to complete the above-mentioned method of generating an installation package. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0100] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned method for generating an installation package when executed by the programmable device.

[0101] In summary, the present disclosure determines association information according to a target document generated in the process of packaging a target application project, wherein the target document is used to record each layout file included in the target application project and the target control class referenced by each layout file, and the association information is used to characterize the association between the file identifier of each layout file and the class identifier of the target control class; detects whether all class identifiers in the association information are included in a class set, wherein the class set includes the class identifiers of all control classes included in the target application project; and when it is determined that all class identifiers are included in the class set, continues to execute the process to generate an installation package for the target application project. The control class referenced by the layout file can be detected in the process of generating the installation package, thereby avoiding abnormal control class references and improving the reliability of the generated installation package.

[0102] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0103] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for generating an installation package, characterized in that: The method comprises: In the process of packaging the target application project, the file identifier of each layout file recorded in the target document generated in the process and the class identifier of the target control class referenced by each layout file are detected to obtain association relationship information, wherein the association relationship information is used to characterize the association relationship between the file identifier and the class identifier; Detecting whether all class identifiers in the association relationship information are included in a class set, wherein the class set includes class identifiers of all control classes included in the target application project; In the case where it is determined that all the class identifiers are included in the class set, continuing to execute the processing to generate an installation package of the target application project; The step of detecting whether all class identifiers in the association relationship information are included in the class set includes: Searching the target application project by using a preset bytecode operation tool to determine all the control classes; Cache the class identifiers of all the control classes into the target container to obtain the class set; Each class identifier in the association relationship information is matched with the class set to determine whether all class identifiers in the association relationship information are included in the class set.

2. The method according to claim 1, characterized in that After detecting whether all class identifiers in the association relationship information are included in the class set, the method further includes: When it is determined that there is a target class identifier in the association relationship information that is not included in the class set, the processing process is stopped and a prompt message is output; wherein the prompt message includes: each of the target class identifiers in the association relationship information, and the file identifier of each target layout file, and the class identifier of the target control class referenced by the target layout file is the target class identifier.

3. The method according to claim 1, characterized in that In the process of packaging the target application project, detecting the file identifier of each layout file recorded in the target document generated in the process and the class identifier of the target control class referenced by each layout file to obtain the association relationship information includes: Execute the processing by using a preset packaging tool until a target document is generated; Reading the target document through a preset task plug-in to determine the file identifier of each layout file in the target document, the class identifier of the target control class, and the reference relationship between each layout file and the target control class; According to the reference relationship, the file identifier of each layout file and the class identifier of the target control class are stored in the form of a key-value pair as the association relationship information.

4. A device for generating an installation package, characterized in that: The device comprises: An information determination module is configured to detect, during a process of packaging a target application project, a file identifier of each layout file recorded in a target document generated during the process and a class identifier of a target control class referenced by each layout file, so as to obtain association relationship information, wherein the association relationship information is used to characterize an association relationship between the file identifier and the class identifier; an identification detection module, configured to detect whether all class identifications in the association relationship information are included in a class set, wherein the class set includes class identifications of all control classes included in the target application project; An installation package generation module is configured to continue executing the processing to generate an installation package for the target application project when it is determined that all the class identifiers are included in the class set; The identification detection module is further configured to: Searching the target application project by using a preset bytecode operation tool to determine all the control classes; Cache the class identifiers of all the control classes into the target container to obtain the class set; Each class identifier in the association relationship information is matched with the class set to determine whether all class identifiers in the association relationship information are included in the class set.

5. The device according to claim 4, characterized in that The device also includes: A prompt output module is configured to stop the processing and output prompt information when it is determined that there is a target class identifier that is not included in the class set in the association relationship information; wherein the prompt information includes: each of the target class identifiers in the association relationship information, and the file identifier of each target layout file, and the class identifier of the target control class referenced by the target layout file is the target class identifier.

6. The device according to claim 4, characterized in that The information determination module is configured to: Execute the processing by using a preset packaging tool until the target document is generated; Reading the target document through a preset task plug-in to determine the file identifier of each layout file in the target document, the class identifier of the target control class, and the reference relationship between each layout file and the target control class; According to the reference relationship, the file identifier of each layout file and the class identifier of the target control class are stored in the form of a key-value pair as the association relationship information.

7. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the method described in any one of claims 1 to 3 are implemented.

8. An electronic device, characterized in that: include: The device for generating an installation package according to any one of claims 4 to 6.

Citation Information

Patent Citations

  • Installation package generating method and device

    CN104516755A

  • Method and device for setting control style

    CN105159673A