[go: up one dir, main page]

CN112506519A - Compiling method of application program, mobile terminal and server - Google Patents

Compiling method of application program, mobile terminal and server Download PDF

Info

Publication number
CN112506519A
CN112506519A CN202011480718.7A CN202011480718A CN112506519A CN 112506519 A CN112506519 A CN 112506519A CN 202011480718 A CN202011480718 A CN 202011480718A CN 112506519 A CN112506519 A CN 112506519A
Authority
CN
China
Prior art keywords
program
mobile terminal
compiler
compiling
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011480718.7A
Other languages
Chinese (zh)
Inventor
胡岳伟
吴价
刘圆圆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202011480718.7A priority Critical patent/CN112506519A/en
Publication of CN112506519A publication Critical patent/CN112506519A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/51Source to source
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors

Landscapes

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

Abstract

The application discloses a compiling method of an application program of a mobile terminal, the mobile terminal and a server, wherein the compiling method is applied to a cloud end or a PC end, and comprises the following steps: acquiring a source program of an application program; configuring a compiler of a source program to a virtual machine of a cloud end or a PC end; compiling and generating a target program corresponding to the source program by utilizing a compiler based on the virtual machine; and outputting the target program to the mobile terminal. By means of the method, system resources of the mobile terminal can be saved, the installation performance of the mobile terminal is optimized, and therefore user experience is improved.

Description

Compiling method of application program, mobile terminal and server
Technical Field
The present application relates to the field of program installation, and in particular, to a compiling method for an application program, a mobile terminal, and a server.
Background
Generally, with the mass Application of mobile terminals, various software and Applications (APPs) installed on the mobile terminals are increasing, and the multiple use and optimization rate of the mobile terminals greatly enrich the lives of people.
In a mobile terminal, an application program is installed, generally downloaded in an android system, and then the downloaded file is opened and installed, so that the application program is installed on the mobile terminal for subsequent use by a user.
At present, because an android system of a mobile terminal needs to run at an android end when installing and compiling, and a running script is generated by compiling when installing, in the process of installing and compiling a package, more resources need to be consumed, such as: the method comprises the steps that time resources, tool resources, electric quantity resources, flow resources, storage resources and the like are used, so that the installation process is limited by the android terminal, the optimization process of the installation package is severely limited in this way, the installation performance of the android terminal is reduced, and the user experience goodness is reduced.
Disclosure of Invention
A first aspect of the embodiments of the present application provides a compiling method for an application program of a mobile terminal, where the compiling method is applied to a cloud or a PC, and the method includes: acquiring a source program of an application program; configuring a compiler of a source program to a virtual machine of a cloud end or a PC end; compiling and generating a target program corresponding to the source program by utilizing a compiler based on the virtual machine; and outputting the target program to the mobile terminal.
A second aspect of the embodiments of the present application provides an installation method of an application program of a mobile terminal, where the installation method is applied to the mobile terminal, and the installation method includes: sending a to-be-installed instruction of an application program to a cloud end or a PC end so that the cloud end or the PC end obtains a source program of the application program according to the to-be-installed instruction and compiles to generate a target program corresponding to the source program; and receiving the application program from the cloud end or the PC end and installing the application program, wherein the received application program comprises the compiled object program, so that the mobile terminal can skip the compiling source program when the application program is installed and directly use the compiled object program.
A third aspect of an embodiment of the present application provides a server, including: the acquisition module is used for acquiring a source program of the application program; the configuration module is used for configuring a compiler of the source program to a virtual machine of the server; the compiling module is used for compiling and generating a target program corresponding to the source program by utilizing a compiler based on the virtual machine; and the output module is used for outputting the target program to the mobile terminal.
A fourth aspect of an embodiment of the present application provides a mobile terminal, including: the instruction output module is used for sending an instruction to be installed of the application program to the cloud end or the PC end so that the cloud end or the PC end can obtain a source program of the application program according to the instruction to be installed and compile and generate a target program corresponding to the source program; the installation module is used for receiving the application program from the cloud end or the PC end and installing the application program, wherein the received application program comprises a compiled target program, so that the mobile terminal can skip the compiling of a source program when the application program is installed and directly use the compiled target program.
A fifth aspect of an embodiment of the present application provides another server, including: the device comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used for executing the computer program to realize the method provided by the first aspect of the embodiment of the application.
A sixth aspect of an embodiment of the present application provides a mobile terminal, including: a processor and a memory, the memory having stored therein a computer program, the processor being configured to execute the computer program to implement the method provided by the second aspect of the embodiments of the present application.
A seventh aspect of embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program is capable of implementing the method provided by the first aspect or the second aspect of embodiments of the present application when executed by a processor.
The beneficial effect of this application is: different from the situation of the prior art, the android compiling method for the mobile terminal aims at the android compiling technology of the current mobile terminal, firstly, a real android system installation environment of the mobile terminal is simulated by using a cloud or PC-end virtual machine, a source program is compiled by using a compiler on the cloud or PC-end virtual machine, and an object program corresponding to the source program is output to the mobile terminal, the mobile terminal can directly use the object program to use an application program, so that a link is omitted on the mobile terminal, the compiling process is executed at the PC end in advance, and performance resources consumed in the downloading and installing process are saved. In this way, the source program can be compiled effectively by simulating an android installation environment through a cloud or a PC, system resources of the mobile terminal can be saved, and the installation performance of the mobile terminal is optimized, so that the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a first embodiment of a method for compiling an application program of a mobile terminal according to the present application;
FIG. 2 is a flowchart illustrating an embodiment of step S12 of FIG. 1;
FIG. 3 is a flowchart illustrating an embodiment of step S13 of FIG. 1;
FIG. 4 is a flowchart illustrating a second embodiment of a method for compiling an application program of a mobile terminal according to the present application;
FIG. 5 is a flowchart illustrating a method for installing an application program in a mobile terminal according to the present application to verify whether a target program is correct;
fig. 6 is a flowchart illustrating a second embodiment of an installation method of an application program of a mobile terminal according to the present application;
FIG. 7 is a schematic block diagram of one embodiment of a server of the present application;
FIG. 8 is a schematic block diagram of an embodiment of a mobile terminal of the present application;
FIG. 9 is a schematic block diagram of another embodiment of a server or mobile terminal of the present application
FIG. 10 is a schematic block diagram of one embodiment of a computer-readable storage medium of the present application;
fig. 11 is a schematic block diagram of a hardware architecture of a mobile terminal of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Fig. 1 is a schematic diagram illustrating the technical solution of the present application, and the following description is made by using a specific example. The present application provides a method for compiling an application program of a mobile terminal, where the method is applied to a cloud or a Personal Computer (PC), please refer to fig. 1, where fig. 1 is a schematic flow diagram of a first embodiment of the method for compiling an application program of a mobile terminal of the present application, and the method includes the following specific steps:
s11: acquiring a source program of an application program;
generally, before compiling a source program, a corresponding application program needs to be found. Typically, the applications have corresponding names, such as WeChat, Paibao, Mei Tuo, and nailing, to name a few. The name corresponding to one application program is configured, and in most cases, the name can be used for distinguishing other application programs, so that a user can conveniently and quickly search the application program.
Generally, it is determined that an application program needs to be applied, and a source program of the application program can be correspondingly acquired from a local resource on a network server, a cloud end or a PC end through the application program. A source program, also known as source code, is an uncompiled text file written according to a certain programming language specification, which is a series of human-readable computer language instructions. The source program in the present application may be a source program of an application program corresponding to a model of the mobile terminal.
The source program of the application program and the compiler corresponding to the source program may also be obtained when the source program corresponding to the application program is obtained, and of course, according to the controllable operation of related technical personnel in the field, the source program of the application program and the compiler corresponding to the source program may also be obtained at the same time, and then the compiler corresponding to the source program is obtained, specifically, the selection is performed according to the actual requirement, which is not limited here.
S12: configuring a compiler of a source program to a virtual machine of a cloud end or a PC end;
because the compiling method is actually operated at the cloud end or the PC end, the compiler is actually downloaded to the cloud end or the PC end from the network, or is stored in the cloud end or the PC end before, and is directly acquired when being called.
In order to ensure that the cloud end or the PC end has an installation development environment of the application program corresponding to the mobile terminal, a virtual machine of the cloud end or the PC end can be set, and the virtual machine can simulate an android system installation environment of the mobile terminal, such as a framework for installing the application program and a path for installing a boot type.
Because the compiler of the source program is stored in the cloud or the PC, in order to better simulate the installation and development environment of the mobile terminal, the compiler of the source program can be configured to the virtual machine of the cloud or the PC so as to better simulate the installation and development environment of the mobile terminal.
S13: compiling and generating a target program corresponding to the source program by utilizing a compiler based on the virtual machine;
the target program is also called a destination program. The source program is a set of machine codes that can be directly run by a computer after being compiled, and the program is obtained by special software such as a compiler through translation and processing. In general, a binary code obtained by compiling a source program by a compiler is called a target program. The extension of the target program is ". obj".
Generally, object code, although already machine instructions, cannot be executed because the object program also needs to solve the function call problem, and each object program needs to be connected with a library function to form a complete executable program.
Therefore, based on the cloud or PC virtual machine, in the virtual machine, the compiler may be used to compile and generate the object program corresponding to the source program, and the process of compiling the source program by the compiler is actually a process of compiling and generating the object code corresponding to the source program and establishing an association relationship between each object code and a corresponding library function to obtain the object program.
S14: and outputting the target program to the mobile terminal.
And a folder for storing the target program is preset at the cloud end or the PC end and is used for storing the target program generated by compiling the source program by the compiler. Generally, because the size of the space of the virtual machine is actually limited, the folder for storing the target program can be arranged on the cloud or the PC instead of the virtual machine, so that the compiler has enough space to compile, thereby improving the compiling efficiency.
Because the virtual machine has a communication relationship with the cloud end or the PC end, a target program compiled and generated by the virtual machine can be placed in a directory configured by the cloud end or the PC end, namely a folder preset in the cloud end or the PC end. And for the compiled object program, outputting the object program to the mobile terminal through a cloud end or a PC end so that the mobile terminal can directly use the application program.
Still further, outputting the target program to the mobile terminal may specifically include: and modifying the system path of the application program, wherein the system path actually means that the system path of the application program used in the mobile terminal is established in the packaging process before the target program is sent to the mobile terminal, so that the corresponding function index is found when the application program is clicked on the mobile terminal. And then outputting the application program to the mobile terminal, wherein the output application program comprises the compiled object program, so that the mobile terminal can skip the compiling of the source program when the application program is installed and directly use the compiled object program.
The android compiling method is used for simulating a real android system installation environment of the mobile terminal by using a cloud or PC-end virtual machine, compiling a source program by using a compiler on the cloud or PC-end virtual machine, outputting a target program corresponding to the source program to the mobile terminal, and directly using the target program by the mobile terminal so as to use an application program, so that links are omitted on the mobile terminal, the compiling process is executed at the PC-end in advance, and performance resources consumed in the downloading and installing process are saved. In this way, the source program can be compiled effectively by simulating an android installation environment through a cloud or a PC, system resources of the mobile terminal can be saved, and the installation performance of the mobile terminal is optimized, so that the user experience is improved.
Further, please refer to fig. 2, in which a compiler of a source program is configured to a virtual machine of a cloud or a PC, and fig. 2 is a flowchart illustrating an embodiment of step S12 in fig. 1, which includes the following steps:
s21: acquiring a compiler compression packet from a source program;
because the downloaded source program and the compiler corresponding to the source program are contained in one compressed package, the compiler corresponding to the source program can be obtained when the source program is downloaded from the internet, and the source program corresponding to the application program and the compiler corresponding to the source program can be downloaded from the internet according to different application programs and different types of mobile phones.
Generally, in order to facilitate the acquisition and consistency of resources, a compiler compression package is generally stored with a corresponding original program as a whole, so that the consistency and the order of the source program and the compiler corresponding to the source program can be ensured when the compiler compression package is used, and therefore, the compiler compression package needs to be acquired from the source program, such as dex2oat x86, where x86 corresponds to the model of a mobile terminal, such as the model of a mobile phone.
Of course, the source program and the compiler corresponding to the source program may be obtained simultaneously, or the source program may be obtained first, and then the compiler corresponding to the source program is obtained, which is determined according to the actual situation, and this is not limited herein.
S22: decompressing the compiler compression packet;
due to the concept of saving space resources, the source program and the compiler corresponding to the source program stored as a whole are actually a huge compression package, which needs to be decompressed during the use process, and a first folder containing the source program and the compiler corresponding to the source program can be obtained through decompression.
In the first folder, the compiler compression package may be found, and after the compiler compression package is continuously decompressed, a second folder corresponding to the decompressed compiler may be obtained, for example, the compiler compression package art-x86-19065-user.
Of course, since the compiler compression package may be directly obtained from the local repository of the cloud or the PC, or may be directly decompressed, in addition, if the second folder corresponding to the decompressed compiler directly exists in the local repository of the cloud or the PC, the compiler folder may also be obtained without being decompressed.
S23: and configuring a placement path of the compiler to transplant the compiler to the virtual machine.
And configuring a placing path of the compiler on the virtual machine, namely configuring a folder for placing the compiler so as to transplant the compiler to the virtual machine, so that when the compiler is operated, the compiler performs compiling operation on the source program on the virtual machine to simulate the installation environment of the mobile terminal to carry out compiling, and an object program under the same environment as the android system of the mobile terminal can be obtained as far as possible, thereby ensuring the consistency of the object program.
Further, based on the virtual machine, a compiler is utilized to compile and generate an object program corresponding to the source program, please refer to fig. 3, fig. 3 is a flowchart illustrating an embodiment of step S13 in fig. 1; the method specifically comprises the following steps:
s31: acquiring a compiling execution parameter;
the virtual machine is preset with compilation execution parameters, which are used as reference standards for execution in the compilation process of the compiler, such as library names used for specifying programs to be linked, library files corresponding to the library names, and test parameters, and such as parameters for optimizing execution speed and optimizing a source program, which can be used as preset compilation execution parameters.
Generally, for the compiler to obtain the compiling accuracy in the process of compiling the source program or to obtain a relatively objective target program result, it is necessary to obtain compiling execution parameters, such as preset compiling execution parameters.
The compiling execution parameter may be preset, or may be a parameter information that is actually set on the virtual machine, or may be input, where a unit of the parameter information may be selected from pull-down options on a panel of the virtual machine, or may be input in real time to perform adjustment.
S32: loading a compiler to the virtual machine through the placement path;
because the virtual machine is provided with the placing path, and the compiler is stored in the folder under the placing path, the virtual machine on the cloud or the PC can call the compiler through the placing path, namely, the compiler is loaded to the virtual machine.
A virtual machine refers to a complete computer system with complete hardware system functionality, which is emulated by software, running in a completely isolated environment. Each virtual machine has an independent CMOS, hard disk and operating system, and can be operated like a physical machine.
So set up, through the virtual machine that uses the same installation environment with mobile terminal, can be so that the compiler runs on the host computer, completely independent, all operations in the virtual machine can not influence the host computer, even virtual breakdown, also can not cause harmful effects to high in the clouds or PC end.
S33: and running a compiler on the virtual machine to analyze the source program and generate a target program corresponding to the source program.
Compiling is to change a high-level language into a 2-system language which can be recognized by a computer, the computer only recognizes 1 and 0, and a compiler program changes a familiar language into a 2-system language. The work process of a compiler for translating a source program into a target program comprises five stages: a first lexical analysis; a second syntax analysis; semantic checking and intermediate code generation; optimizing codes; and generating an object code.
The process of compiling the source program by the compiler is actually a process of compiling and generating object codes corresponding to the source program and establishing an association relationship between each object code and a corresponding library function so as to obtain the object program.
And running a compiler on the virtual machine, compiling and analyzing the source program so as to generate an object code corresponding to the source program, and establishing an incidence relation between each object code and a corresponding library function to generate the object program corresponding to the source program.
Further, please refer to fig. 4, wherein fig. 4 is a flowchart illustrating a second embodiment of a compiling method for an application program of a mobile terminal according to the present application; before executing the outputting of the object program to the mobile terminal, the compiling method further includes verifying whether the object program is correctly operable.
Please refer to fig. 3, where fig. 3 is a schematic flowchart of fig. 1, which is a first embodiment of an installation method of an application program of a mobile terminal according to the present application, and specifically includes the following steps:
s41: extracting an execution logic of an execution command of the compiler analysis source program;
a compiler is actually a program that translates "one language (usually a high-level language)" into "another language (usually a low-level language)". The main workflow of a modern compiler: source code → preprocessor → compiler → object code → Linker (Linker) → executable programs (executables).
Generally, a compiler can be obtained by solidifying and packaging a compiler, so that the extraction of the execution logic of the compiler for analyzing the execution command of the source program is actually the extraction of the association between the compiler in the compiler and the code of the compiler.
S42: transplanting the execution logic to a cloud end or a PC end;
generally, for comparison testing, a mobile terminal to be tested may be connected to a cloud or a PC Windows via a USB, and an android system framework (frame) and a boot class path (BOOTCLASSPATH) of the mobile terminal are copied, that is, a native environment of the mobile terminal is copied to a computer, so as to distinguish from a compiling process in a virtual environment.
Specifically, in order to verify whether the target program is operable correctly, the extracted execution logic may be migrated to the cloud or the PC, so that the cloud or the PC compiles the source program according to the extracted execution logic.
The extraction and execution logic or the migration sequence may be performed after the source program is compiled on the virtual machine, or may be performed before the source program is compiled on the virtual machine, and the specific operation sequence is selected according to actual requirements, which is not limited herein.
S43: simulating the running environment of the mobile terminal at the cloud end or the PC end, and executing execution logic to compile a compiling result which can run under the simulated running environment of the corresponding mobile terminal;
because the environment on the virtual machine and the running environment of the cloud or PC-side simulated mobile terminal are always different, the compiling result that can run in the simulated running environment of the corresponding mobile terminal can be compiled by executing the execution logic in the running environment of the cloud or PC-side simulated mobile terminal.
Specifically, an android frame environment is simulated at a PC (personal computer) end, and two binary files of base.odex and base.vdex are generated under a current preset directory; the odex binary file is an executable file extracted from an application program apk on an android, namely the odex binary file generated by optimizing classes in android software, and the odex conversion is to extract the dex file in advance to accelerate the software loading speed and the starting speed.
S44: and comparing the target program with the compiling result to verify whether the target program can run correctly.
And in order to verify whether the target program can run correctly, obtaining the parsed dex2oat command, and compiling arm/arm64 executable base. And comparing and testing the base.odex compiled on the mobile terminal, namely the virtual machine, with the base.odex compiled on the PC so as to ensure the consistency and effectiveness of the PC end or cloud compiling.
Specifically, referring to fig. 5, for how to verify the consistency of the target program, fig. 5 is a schematic flow chart of the method for installing the application program of the mobile terminal to verify whether the target program is correct, and the method specifically includes the following steps:
s51: judging whether the target program is consistent with the compiling result;
because the compiler compiles the source program to generate the target program, and the target program includes two binary files, namely base.odex and base.vdex, in the process of judging whether the target program is consistent with the compiling result, the base.odex binary file of the target program is actually compared with the base.odex binary file corresponding to the compiling result generated by the cloud end or the PC end to judge; specifically, if the object program is consistent with the compiling result, the step S52 is executed, that is, the object program is sent to the mobile terminal; if the target program is not consistent with the compiling result, step S53 is performed, that is, the execution logic code extracted from the compiler on the PC side or the cloud side is modified; specifically, the program that modifies the execution logic code is as follows:
Figure BDA0002837468360000111
s54: and compiling the source program according to the modified execution logic to obtain a compiling result of the modified execution logic code.
For the modified execution logic, the source program is compiled by running the code corresponding to the execution logic, so that the compilation result of the modified execution logic code can be obtained, and the step S51 is returned to perform judgment again until the base.
Further, the present application also provides an installation method of an application program of a mobile terminal, where the installation method is applied to the mobile terminal, please refer to fig. 6, and fig. 6 is a flowchart illustrating a first embodiment of the installation method of the application program of the mobile terminal according to the present application, and the installation method specifically includes the following steps:
s61: sending a to-be-installed instruction of an application program to a cloud end or a PC end so that the cloud end or the PC end obtains a source program of the application program according to the to-be-installed instruction and compiles to generate a target program corresponding to the source program;
s62: and receiving the application program from the cloud end or the PC end and installing the application program, wherein the received application program comprises the compiled object program, so that the mobile terminal can skip the compiling source program when the application program is installed and directly use the compiled object program.
Therefore, compared with the current android compiling technology, the technical scheme of the application saves a compiling link when the APP is downloaded and installed, and executes the compiling process at the PC end in advance, so that performance resources consumed in the downloading and installing process are saved.
This technical scheme compares in present android compiling technique, when downloading installation APP, saves the compiling link, carries out the execution at the PC end in advance with the compiling process, has consequently saved installation time, has improved user's satisfaction.
The technical scheme is used as a mature compiling scheme, can be transplanted to the development of any android project, and can provide reference for compiling all the android projects.
The technical scheme has obvious advantages in android system test, strong expansibility in many scenes, and can achieve the effect only by adjusting or expanding the interface. The invention provides a scheme for transplanting the compiling of the mobile phone APP to a computer by applying a pre-compiling technology in an android mobile phone system scene. In this application scenario, there are several core innovation points:
1. from the product perspective, the compiling technology improves various performances consumed by downloading and installing the mobile phone. The SDK automatic performance case design not only covers all manual service function test scenes, but also designs an interface internal logic test scene, and enters all normal abnormal scenes, so that the test is more fully designed based on an interface logic layer, the performance monitoring level is deeper, and the performance occupation conditions of different resource layers in the interface can be obtained.
2. From the perspective of users, the compiling technology saves the downloading time, the electricity consumption and the like, and improves the satisfaction degree of users. The traditional SDK test is a manual design case and an execution case, each version iteration needs to invest a large amount of labor cost, and if the labor is replaced, the time cost for familiarizing the service is brought. According to the scheme, codes are adopted to realize testing, each iteration code can be reused, and labor and time costs are greatly saved.
3. The scheme has strong portability and can be applied to and used for reference in almost any android mobile phone. Therefore, only the layout engineering code needs to be specifically processed and applied to all android system projects. When aiming at a certain product, the application scene is more specific and more targeted, and needs targeted adjustment or expansion to be supported by a better cross-platform (such as an IOS system).
Referring to fig. 7, fig. 7 is a schematic block diagram of a server according to an embodiment of the present application. The embodiment of the present application provides a server 5, including:
an obtaining module 51, configured to obtain a source program of an application program;
a configuration module 52 connected to the obtaining module 51, configured to configure the compiler of the source program to the virtual machine of the server;
a compiling module 53 connected to the configuration module 52, configured to generate an object program corresponding to the source program by using a compiler based on the virtual machine;
and the output module 54 is connected with the compiling module 53 and used for outputting the target program to the mobile terminal.
According to the android compiling method and system, aiming at the android compiling technology of the current mobile terminal, firstly, a virtual machine of a server is used for simulating a real android system installation environment of the mobile terminal, a source program is compiled by utilizing a compiler on a virtual machine of the server, and a target program corresponding to the source program is output to the mobile terminal, the mobile terminal can directly use the target program to use an application program, so that a link is omitted on the mobile terminal, the compiling process is executed in the server in advance, and performance resources consumed in the downloading and installing process are saved. Through the method, the source program can be compiled effectively by simulating the android installation environment through the server, system resources of the mobile terminal can be saved, and the installation performance of the mobile terminal is optimized, so that the user experience is improved.
Referring to fig. 8, fig. 8 is a schematic block diagram of a mobile terminal according to an embodiment of the present application. The embodiment of the present application provides a mobile terminal 6, including:
the instruction output module 61 is configured to send an instruction to be installed of the application program to the cloud or the PC, so that the cloud or the PC obtains a source program of the application program according to the instruction to be installed, and compiles the source program to generate a target program corresponding to the source program;
and the installation module 62 is connected to the instruction output module 61 and is configured to receive an application program from a cloud or a PC and install the application program, where the received application program includes a compiled object program, so that the mobile terminal can skip compiling a source program when installing the application program and directly use the compiled object program.
Further, please refer to fig. 9, fig. 9 is a schematic diagram of another embodiment of the mobile terminal or the server according to the present application. The embodiment of the present application provides another mobile terminal or server 7, including: the processor 71 and the memory 72, the memory 72 stores a computer program 721, and the processor 71 is configured to execute the computer program 721 in the method according to the first aspect of the embodiment of the present application, which is not described herein again.
Referring to fig. 10, fig. 10 is a schematic block diagram of an embodiment of a computer-readable storage medium of the present application. If implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in the computer readable storage medium 80. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage device and includes instructions (computer program 81) for causing a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. The aforementioned storage device includes: various media such as a usb disk, a portable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and electronic devices such as a computer, a mobile phone, a notebook computer, a tablet computer, and a camera having the storage medium.
The description of the implementation process of the computer program in the computer readable storage medium can refer to the above description of the method embodiment of the mobile terminal 80 of the present application, and will not be repeated here.
Referring to fig. 11, fig. 11 is a schematic block diagram of a hardware architecture of a mobile terminal according to the present application, where the mobile terminal 900 may be an industrial computer, a tablet computer, a mobile phone, a notebook computer, and the like, and the mobile phone is taken as an example in the embodiment. The structure of the mobile terminal 900 may include a Radio Frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wifi (wireless fidelity) module 970, a processor 980, a power supply 990, and the like. Wherein the RF circuit 910, the memory 920, the input unit 930, the display unit 940, the sensor 950, the audio circuit 960, and the WiFi module 970 are respectively connected to the processor 980; the power supply 990 is used to supply power to the entire mobile terminal 900.
Specifically, the RF circuit 910 is used for transmitting and receiving signals; the memory 920 is used for storing data instruction information; the input unit 930 is used for inputting information, and may specifically include a touch panel 931 and other input devices 932 such as operation keys; the display unit 940 may include a display panel or the like; the sensor 950 includes an infrared sensor, a laser sensor, etc. for detecting a user approach signal, a distance signal, etc.; a speaker 961 and a microphone 962 are connected to the processor 980 through the audio circuit 960 for emitting and receiving sound signals; the WiFi module 970 is configured to receive and transmit WiFi signals, and the processor 980 is configured to process data information of the mobile terminal.
The above description is only a part of the embodiments of the present application, and not intended to limit the scope of the present application, and all equivalent devices or equivalent processes performed by the content of the present application and the attached drawings, or directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (12)

1.一种移动终端的应用程序的编译方法,其特征在于,所述编译方法应用在云端或PC端,所述编译方法包括:1. A method for compiling an application program of a mobile terminal, wherein the method for compiling is applied in a cloud or a PC, and the method for compiling comprises: 获取所述应用程序的源程序;obtain the source program of the application; 配置所述源程序的编译器至所述云端或所述PC端的虚拟机上;configure the compiler of the source program to the virtual machine on the cloud or the PC; 基于所述虚拟机,利用所述编译器编译生成所述源程序对应的目标程序;Based on the virtual machine, use the compiler to compile and generate a target program corresponding to the source program; 向所述移动终端输出所述目标程序。The target program is output to the mobile terminal. 2.根据权利要求1所述的编译方法,其特征在于,所述配置所述源程序的编译器至所述云端或所述PC端的虚拟机上,包括:2. The compiling method according to claim 1, wherein the configuring the compiler of the source program to the virtual machine on the cloud or the PC side comprises: 从所述源程序获取编译器压缩包;Obtain a compiler compressed package from the source program; 解压所述编译器压缩包,并配置所述编译器的放置路径,以将所述编译器移植至所述虚拟机上。Decompress the compressed package of the compiler, and configure the placement path of the compiler, so as to port the compiler to the virtual machine. 3.根据权利要求2所述的编译方法,其特征在于,所述基于所述虚拟机,利用所述编译器编译生成所述源程序对应的目标程序,包括:3. The compiling method according to claim 2, characterized in that, based on the virtual machine, the target program corresponding to the source program is generated by using the compiler to compile, comprising: 通过所述放置路径,加载所述编译器至所述虚拟机上;Load the compiler to the virtual machine through the placement path; 在所述虚拟机上运行所述编译器解析所述源程序,生成所述源程序对应的所述目标程序。Running the compiler on the virtual machine parses the source program, and generates the target program corresponding to the source program. 4.根据权利要求3所述的编译方法,其特征在于,在执行所述向所述移动终端输出所述目标程序之前,所述编译方法进一步包括:4. The compiling method according to claim 3, wherein before executing the outputting the target program to the mobile terminal, the compiling method further comprises: 验证所述目标程序是否正确可运行。Verify that the target program is correctly operable. 5.根据权利要求4所述的编译方法,其特征在于,所述验证所述目标程序是否正确可运行,包括:5. The compiling method according to claim 4, wherein the verifying whether the target program can be run correctly comprises: 抽取所述编译器解析所述源程序的执行命令的执行逻辑;extracting the execution logic of the compiler to parse the execution command of the source program; 移植所述执行逻辑至所述云端或所述PC端;Porting the execution logic to the cloud or the PC; 在所述云端或所述PC端模拟所述移动终端的运行环境,并执行所述执行逻辑以编译出在对应所述移动终端的模拟运行环境下可运行的编译结果;Simulate the running environment of the mobile terminal on the cloud or the PC, and execute the execution logic to compile a compilation result that can be run in the simulated running environment corresponding to the mobile terminal; 对比所述目标程序与所述编译结果,以验证所述目标程序是否正确可运行。The target program is compared with the compilation result to verify whether the target program can be run correctly. 6.根据权利要求5所述的编译方法,其特征在于,所述向所述移动终端输出所述目标程序,包括:6. The compiling method according to claim 5, wherein the outputting the target program to the mobile terminal comprises: 修改所述应用程序的系统路径;modify the system path of the application; 输出所述应用程序至所述移动终端,其中,输出的所述应用程序包括已经编译的所述目标程序,以使所述移动终端能够在安装所述应用程序时跳过编译所述源程序,而直接使用已经编译的所述目标程序。outputting the application program to the mobile terminal, wherein the output application program includes the already compiled target program, so that the mobile terminal can skip compiling the source program when installing the application program, Instead, the compiled target program is used directly. 7.根据权利要求1所述的编译方法,其特征在于,所述源程序为对应所述移动终端的型号的所述应用程序的源程序。7 . The compiling method according to claim 1 , wherein the source program is the source program of the application program corresponding to the model of the mobile terminal. 8 . 8.一种移动终端的应用程序的安装方法,其特征在于,所述安装方法应用在所述移动终端上,所述安装方法包括:8. A method for installing an application program of a mobile terminal, wherein the installation method is applied on the mobile terminal, and the installation method comprises: 发出所述应用程序的待安装指令至云端或PC端,以使所述云端或PC端根据所述待安装指令获取所述应用程序的源程序,并编译生成所述源程序对应的目标程序;Sending the instruction to be installed of the application to the cloud or the PC, so that the cloud or the PC obtains the source program of the application according to the instruction to be installed, and compiles and generates a target program corresponding to the source program; 从所述云端或所述PC端接收所述应用程序并进行安装,其中,接收的所述应用程序包括已经编译的所述目标程序,以使所述移动终端能够在安装所述应用程序时跳过编译所述源程序,而直接使用已经编译的所述目标程序。Receive the application program from the cloud or the PC and install it, wherein the received application program includes the compiled target program, so that the mobile terminal can skip the application program when installing the application program. By compiling the source program, the compiled target program is directly used. 9.一种服务器,其特征在于,包括:9. A server, characterized in that, comprising: 获取模块,用于获取所述应用程序的源程序;an acquisition module for acquiring the source program of the application; 配置模块,连接所述获取模块,用于配置所述源程序的编译器至所述服务器的虚拟机上;a configuration module, connected to the acquisition module, for configuring the compiler of the source program to the virtual machine of the server; 编译模块,连接所述配置模块,用于基于所述虚拟机利用所述编译器编译生成所述源程序对应的目标程序;a compilation module, connected to the configuration module, for compiling and generating a target program corresponding to the source program based on the virtual machine using the compiler; 输出模块,连接所述编译模块,用于向所述移动终端输出所述目标程序。The output module is connected to the compilation module, and is used for outputting the target program to the mobile terminal. 10.一种移动终端,其特征在于,包括:10. A mobile terminal, comprising: 指令输出模块,用于发出应用程序的待安装指令至云端或PC端,以使所述云端或PC端根据所述待安装指令获取所述应用程序的源程序,并编译生成所述源程序对应的目标程序;The instruction output module is used to send the instruction to be installed of the application to the cloud or the PC, so that the cloud or the PC obtains the source program of the application according to the instruction to be installed, and compiles and generates the corresponding source program the target program; 安装模块,连接所述指令输出模块,用于从所述云端或所述PC端接收所述应用程序并进行安装,其中,接收的所述应用程序包括已经编译的所述目标程序,以使所述移动终端能够在安装所述应用程序时跳过编译所述源程序,而直接使用已经编译的所述目标程序。The installation module is connected to the instruction output module, and is used to receive the application program from the cloud or the PC and install it, wherein the received application program includes the compiled target program, so that all The mobile terminal can skip compiling the source program when installing the application program, and directly use the compiled target program. 11.一种服务器,其特征在于,包括:处理器和存储器,所述存储器中存储有计算机程序,所述处理器用于执行所述计算机程序以实现如权利要求1-7任一项所述的方法。11. A server, characterized by comprising: a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to execute the computer program to implement the method according to any one of claims 1-7. method. 12.一种移动终端,其特征在于,包括:处理器和存储器,所述存储器中存储有计算机程序,所述处理器用于执行所述计算机程序以实现如权利要求8所述的方法。12. A mobile terminal, comprising: a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to execute the computer program to implement the method according to claim 8.
CN202011480718.7A 2020-12-15 2020-12-15 Compiling method of application program, mobile terminal and server Pending CN112506519A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011480718.7A CN112506519A (en) 2020-12-15 2020-12-15 Compiling method of application program, mobile terminal and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011480718.7A CN112506519A (en) 2020-12-15 2020-12-15 Compiling method of application program, mobile terminal and server

Publications (1)

Publication Number Publication Date
CN112506519A true CN112506519A (en) 2021-03-16

Family

ID=74972081

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011480718.7A Pending CN112506519A (en) 2020-12-15 2020-12-15 Compiling method of application program, mobile terminal and server

Country Status (1)

Country Link
CN (1) CN112506519A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076106A (en) * 2021-03-29 2021-07-06 Oppo广东移动通信有限公司 Method for compiling application, method for running application and electronic equipment
CN116185948A (en) * 2022-12-27 2023-05-30 深圳市云积分科技有限公司 Migration method and device, storage medium, and electronic equipment of code virtual environment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080059957A1 (en) * 2006-08-29 2008-03-06 International Business Machines Corporation Method of compiling source code, compiler, computer system, and computer program product
US20130185626A1 (en) * 2012-01-13 2013-07-18 Obigo Inc. METHOD, TERMINAL AND COMPUTER-READABLE RECORDING MEDIUM FOR COMPILING JAVASCRIPT INCLUDED IN WEB APPLICATION USING Ahead-Of-Time (AOT)
US20140082597A1 (en) * 2012-09-14 2014-03-20 Hassan Chafi Unifying static and dynamic compiler optimizations in source-code bases
CN105930151A (en) * 2016-04-15 2016-09-07 北京小米移动软件有限公司 Application compilation method and apparatus as well as terminal
CN106648681A (en) * 2016-12-29 2017-05-10 南京科远自动化集团股份有限公司 System and method for compiling and loading programmable language
US20180032420A1 (en) * 2016-07-31 2018-02-01 Microsoft Technology Licensing Llc. Debugging Tool For A JIT Compiler
CN111209005A (en) * 2020-01-06 2020-05-29 腾讯科技(深圳)有限公司 Method and apparatus for compiling program file, and computer-readable storage medium
CN111492345A (en) * 2018-10-15 2020-08-04 华为技术有限公司 Method for optimizing and running android application program and related device
CN111913688A (en) * 2019-05-08 2020-11-10 北京火星人视野科技有限公司 A program development method and system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080059957A1 (en) * 2006-08-29 2008-03-06 International Business Machines Corporation Method of compiling source code, compiler, computer system, and computer program product
US20130185626A1 (en) * 2012-01-13 2013-07-18 Obigo Inc. METHOD, TERMINAL AND COMPUTER-READABLE RECORDING MEDIUM FOR COMPILING JAVASCRIPT INCLUDED IN WEB APPLICATION USING Ahead-Of-Time (AOT)
US20140082597A1 (en) * 2012-09-14 2014-03-20 Hassan Chafi Unifying static and dynamic compiler optimizations in source-code bases
CN105930151A (en) * 2016-04-15 2016-09-07 北京小米移动软件有限公司 Application compilation method and apparatus as well as terminal
US20180032420A1 (en) * 2016-07-31 2018-02-01 Microsoft Technology Licensing Llc. Debugging Tool For A JIT Compiler
CN106648681A (en) * 2016-12-29 2017-05-10 南京科远自动化集团股份有限公司 System and method for compiling and loading programmable language
CN111492345A (en) * 2018-10-15 2020-08-04 华为技术有限公司 Method for optimizing and running android application program and related device
CN111913688A (en) * 2019-05-08 2020-11-10 北京火星人视野科技有限公司 A program development method and system
CN111209005A (en) * 2020-01-06 2020-05-29 腾讯科技(深圳)有限公司 Method and apparatus for compiling program file, and computer-readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076106A (en) * 2021-03-29 2021-07-06 Oppo广东移动通信有限公司 Method for compiling application, method for running application and electronic equipment
CN116185948A (en) * 2022-12-27 2023-05-30 深圳市云积分科技有限公司 Migration method and device, storage medium, and electronic equipment of code virtual environment

Similar Documents

Publication Publication Date Title
CN110716715B (en) Application program development method, device, equipment and medium
CN112631622B (en) Application installation method, device, server and computer readable medium
CN103744709B (en) patch loading method and device
CN112685035B (en) Project development method and device, computer readable storage medium and electronic equipment
WO2017185606A1 (en) Overlay mechanism-based apk development method and system
CN106126290A (en) Application program optimization method, Apparatus and system
CN105677335A (en) Method and device for increasing first starting speed of mobile terminal
US20150143348A1 (en) Hybrid dynamic code compiling device, method, and service system thereof
CN111949491B (en) SQL extraction method and device of MyBatis application program
CN113434154B (en) Android application packaging method, device, storage medium and electronic device
CN111723002A (en) A code debugging method, device, electronic device and storage medium
CN103677814A (en) Program acquisition method, device and system
CN112506519A (en) Compiling method of application program, mobile terminal and server
CN114579457A (en) Novel power system firmware operation simulation platform and simulation method
CN116166907B (en) Method and device for developing Web application by using WebAsssembly and service page compiling technology
CN114527988A (en) Installation package generation method and device
CN113590127A (en) Compiled data processing method and device, electronic equipment and storage medium
CN102725732A (en) Method and device for improving mobile Widget application performance
CN116647447A (en) A hot update method, device, smart device and storage medium for an application program
CN115544518A (en) Vulnerability scanning engine implementation method and device, vulnerability scanning method and electronic equipment
CN111290746B (en) Object access method, device, equipment and storage medium
CN114168150B (en) Application compilation method, device, electronic device and storage medium
CN112527574B (en) Processor testing method, device, equipment and readable storage medium
CN117411906A (en) Implementation method and system of RTOS (real time operating System) embedded in QuickJS engine
CN116991434A (en) Packet reorganization method, system and storage medium for android APP

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210316