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
compiling
compiler
application program
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; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/51Source to source
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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

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. The compiling method of the application program of the mobile terminal is applied to a cloud end or a PC end, and comprises the following steps:
acquiring a source program of the application program;
configuring a compiler of the source program to a virtual machine of the cloud end or the PC end;
compiling and generating a target program corresponding to the source program by utilizing the compiler based on the virtual machine;
and outputting the target program to the mobile terminal.
2. The compiling method according to claim 1, wherein the configuring the compiler of the source program onto the virtual machine of the cloud or the PC comprises:
obtaining a compiler compression package from the source program;
decompressing the compiler compression package and configuring a placement path of the compiler to migrate the compiler to the virtual machine.
3. The compiling method according to claim 2, wherein the generating of the object program corresponding to the source program by the compiler compiling based on the virtual machine comprises:
loading the compiler to the virtual machine through the placement path;
and running the compiler on the virtual machine to analyze the source program and generate the target program corresponding to the source program.
4. The compiling method according to claim 3, wherein before executing the outputting of the object program to the mobile terminal, the compiling method further comprises:
and verifying whether the target program can run correctly.
5. The compiling method of claim 4 wherein the verifying whether the target program is correctly operable comprises:
extracting execution logic of the compiler for analyzing the execution command of the source program;
transplanting the execution logic to the cloud end or the PC end;
simulating the running environment of the mobile terminal at the cloud end or the PC end, and executing the execution logic to compile a compiling result which can run under the simulated running environment corresponding to the mobile terminal;
and comparing the target program with the compiling result to verify whether the target program can run correctly.
6. The compiling method according to claim 5, wherein the outputting the object program to the mobile terminal comprises:
modifying a system path of the application;
outputting the application program to the mobile terminal, wherein the output application program comprises the object program which is compiled, so that the mobile terminal can skip compiling the source program when installing the application program and directly use the compiled object program.
7. The compiling method according to claim 1 wherein the source program is a source program of the application program corresponding to a model of the mobile terminal.
8. An installation method of an application program of a mobile terminal, wherein the installation method is applied to the mobile terminal, and the installation method comprises the following steps:
sending a to-be-installed instruction of the 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 and generates a target program corresponding to the source program;
and receiving the application program from the cloud or the PC terminal and installing the application program, wherein the received application program comprises the compiled object program, so that the mobile terminal can skip the compiling of the source program when installing the application program and directly use the compiled object program.
9. A server, comprising:
the acquisition module is used for acquiring a source program of the application program;
the configuration module is connected with the acquisition module and used for configuring the compiler of the source program to a virtual machine of the server;
the compiling module is connected with the configuration module and used for compiling and generating a target program corresponding to the source program by utilizing the compiler based on the virtual machine;
and the output module is connected with the compiling module and used for outputting the target program to the mobile terminal.
10. A mobile terminal, comprising:
the instruction output module is used for sending an instruction to be installed of an application program to a cloud end or a 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;
and the installation module is connected with the instruction output module and 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 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.
11. A server, comprising: a processor and a memory, the memory having stored therein a computer program for execution by the processor to implement the method of any one of claims 1-7.
12. A mobile terminal, comprising: a processor and a memory, the memory having stored therein a computer program for execution by the processor to implement the method of 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 (1)

* 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

Citations (5)

* 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
US20140082597A1 (en) * 2012-09-14 2014-03-20 Hassan Chafi Unifying static and dynamic compiler optimizations in source-code bases
CN106648681A (en) * 2016-12-29 2017-05-10 南京科远自动化集团股份有限公司 System and method for compiling and loading programmable language
CN111209005A (en) * 2020-01-06 2020-05-29 腾讯科技(深圳)有限公司 Method and apparatus for compiling program file, and computer-readable storage medium
CN111913688A (en) * 2019-05-08 2020-11-10 北京火星人视野科技有限公司 Program development method and system

Patent Citations (5)

* 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
US20140082597A1 (en) * 2012-09-14 2014-03-20 Hassan Chafi Unifying static and dynamic compiler optimizations in source-code bases
CN106648681A (en) * 2016-12-29 2017-05-10 南京科远自动化集团股份有限公司 System and method for compiling and loading programmable language
CN111913688A (en) * 2019-05-08 2020-11-10 北京火星人视野科技有限公司 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 (1)

* 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

Similar Documents

Publication Publication Date Title
CN108897562B (en) Installation package updating method, device, medium and equipment
CN100365590C (en) Debugging method for applied programm in simulator of embedded system
KR102059705B1 (en) Adaptive portable libraries
CN107451474B (en) Software bug fixing method and device for terminal
CN105100191A (en) Method, device and system for realizing Java application installation via cloud compilation
US9182953B2 (en) Hybrid dynamic code compiling device, method, and service system thereof
WO2019005228A1 (en) Automated source code adaption to inject features between platform versions
CN112685035A (en) Project development method and device, computer-readable storage medium and electronic device
CN103885814A (en) Simulator device and method for operating ARM APKs on x86 framework
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
CN111723002A (en) Code debugging method and device, electronic equipment and storage medium
CN112631622A (en) Application installation method and device, server and computer readable medium
CN112882718A (en) Compiling processing method, device, equipment and storage medium
CN112506519A (en) Compiling method of application program, mobile terminal and server
CN113741954A (en) System software generation method and device, electronic equipment and storage medium
CN116166907B (en) Method and device for developing Web application by using WebAsssembly and service page compiling technology
CN114579457A (en) Novel power system firmware operation simulation platform and simulation method
CN115544518A (en) Vulnerability scanning engine implementation method and device, vulnerability scanning method and electronic equipment
CN112596751A (en) Compiling method, terminal, server and storage medium of application program installation package
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
EP2597568A1 (en) Method and device for improving performance of mobile widget
JP2016515243A (en) Method for automatic conversion of package for taizen installation of android application and computer-readable recording medium therefor
CN113704081A (en) Automatic testing method and system for application program compatibility
CN112052007A (en) Source code debugging method, device, server and storage medium
CN112612474A (en) Product transplanting method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination