CN114860335A - Application program running method, electronic equipment and storage medium - Google Patents

Application program running method, electronic equipment and storage medium Download PDF

Info

Publication number
CN114860335A
CN114860335A CN202210456071.7A CN202210456071A CN114860335A CN 114860335 A CN114860335 A CN 114860335A CN 202210456071 A CN202210456071 A CN 202210456071A CN 114860335 A CN114860335 A CN 114860335A
Authority
CN
China
Prior art keywords
file
target
executable file
package
function
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
CN202210456071.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.)
Zhangyue Technology Co Ltd
Original Assignee
Zhangyue Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhangyue Technology Co Ltd filed Critical Zhangyue Technology Co Ltd
Priority to CN202210456071.7A priority Critical patent/CN114860335A/en
Publication of CN114860335A publication Critical patent/CN114860335A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • 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/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

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

Abstract

The disclosure relates to an application program running method, an electronic device and a storage medium. The running method of the application program comprises the following steps: in response to the detection of the starting operation of the application program, loading a sub-program package in the application program to obtain a first executable file corresponding to the sub-program package; merging the first executable file and a second executable file corresponding to the application program to obtain a third executable file; updating the file name of a target class file in the third executable file to a target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration; and according to the fourth executable file, registering a target function corresponding to the target class file so as to run the application program. According to the embodiment of the disclosure, the functions corresponding to the sub-packages in the plug-in application program can be registered, so that the application program can normally run, the use requirements of users are met, and the user experience is improved.

Description

Application program running method, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an application program running method, an electronic device, and a storage medium.
Background
On the intelligent terminal, a user can meet the use requirement of the user through a third-party Application program (APP). In order to facilitate the use of the user and improve the use experience of the user, some corresponding functions are often realized by an APP function plug-in method.
However, in the plug-in APP, due to the delayed nature of plug-in loading corresponding to plug-in, the plug-in APP cannot actively register the plug-in when started, so that functions corresponding to the plug-in APP plug-in cannot be normally registered, normal operation of the plug-in APP is influenced, functional requirements of a user cannot be met, and user experience is influenced.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the present disclosure provides an application program running method, an electronic device, and a storage medium.
In a first aspect, the present disclosure provides an application program running method, including:
in response to the detection of the starting operation of the application program, loading a sub-program package in the application program to obtain a first executable file corresponding to the sub-program package;
merging the first executable file and a second executable file corresponding to the application program to obtain a third executable file;
updating the file name of a target class file in the third executable file to a target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration;
and according to the fourth executable file, registering a target function corresponding to the target class file so as to run the application program.
In a second aspect, the present disclosure provides an electronic device comprising a processor and a memory, the memory for storing executable instructions that cause the processor to:
in response to the detection of the starting operation of the application program, loading a sub-program package in the application program to obtain a first executable file corresponding to the sub-program package;
merging the first executable file and a second executable file corresponding to the application program to obtain a third executable file;
updating the file name of a target class file in the third executable file to a target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration;
and according to the fourth executable file, registering a target function corresponding to the target class file so as to run the application program.
In a third aspect, the present disclosure provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to implement the method of running the application program of the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
the application program running method, the electronic device and the storage medium of the disclosed embodiment can detect and respond to the starting operation of the application program by a user, load the sub-package in the application program to obtain the first executable file corresponding to the sub-package, then merge the first executable file with the second executable file corresponding to the application program to obtain the third executable file, then update the file name of the target class file in the third executable file to the target file name to obtain the fourth executable file, and further register the target function corresponding to the target class file according to the fourth executable file to run the application program, because the target class file is the function class file corresponding to the sub-package and the target file name is the file name which can be identified during function registration, registration of the target function corresponding to the target class file can be realized based on the target file name which can be identified, the application program can normally run, so that the functional requirements of the user are met, and the user experience is improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a flowchart illustrating an operation method of an application according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating another method for running an application according to an embodiment of the present disclosure;
fig. 3 is a flow chart illustrating a method for registering a function of a content provider according to an embodiment of the disclosure;
fig. 4 is a flowchart illustrating a content recipient function registration method according to an embodiment of the disclosure;
fig. 5 shows a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The embodiment of the disclosure provides an application program running method, electronic equipment and a storage medium.
Next, an operation method of an application provided in an embodiment of the present disclosure is first described with reference to fig. 1.
The method for running the application program provided by the embodiment of the disclosure can be used by an electronic device capable of running the application program. The electronic device may include, but is not limited to, a mobile terminal such as a smart phone, a notebook computer, a Personal Digital Assistant (PDA), a PAD, a Portable Multimedia Player (PMP), a vehicle-mounted terminal (e.g., a car navigation terminal), a wearable device, and the like, and a stationary terminal such as a digital TV, a desktop computer, a smart home device, and the like.
Fig. 1 shows a flowchart of an application running method according to an embodiment of the present disclosure.
As shown in fig. 1, the method for running the application program may include the following steps.
S110, in response to the detection of the starting operation of the application program, loading the sub-program package in the application program to obtain a first executable file corresponding to the sub-program package.
In the embodiment of the present disclosure, when a user wants to start an application program in an electronic device, a start operation of the application program may be input to the electronic device. After detecting the start operation, the electronic device may respond to the start operation and load the sub-package in the application program, so as to obtain the first executable file corresponding to the sub-package.
In the embodiment of the present disclosure, the starting operation may be any operation capable of triggering the electronic device to start the application program.
Optionally, the starting operation may be a gesture control operation (such as clicking, long-pressing, double-clicking, etc.) for a program icon of the application program, a voice control operation, and an expression control operation, which are not limited herein.
In the disclosed embodiment, the application may be an application to be started.
Alternatively, the application may be any plug-in application. For example, the application program may be a plug-in e-book application program, a video playing application program, a navigation application program, a game application program, a chat application program, and the like, which is not limited herein.
The plug-in application is an application composed of dynamic independent modules, and each independent module can realize at least one service function. Each independent module of the plug-in application program can meet a certain plug-in protocol, and communication between the main program and the independent module and communication between the independent modules can be realized by means of the main program.
Alternatively, one sub-package may be a package corresponding to one module in the application.
Alternatively, the first executable file may be any type of file that is installed and can be executed to implement the function of the plug-in module corresponding to the sub-package. For example, the first executable file may be a dex file, which may be a collection of class (class) files.
Specifically, after detecting a start operation of the application program by the user, the electronic device may load a sub-package included in the application program in response to the start operation, and further obtain a first executable file corresponding to the sub-package.
The method for loading the sub-package by the electronic device is explained in detail below.
Optionally, the loading the sub-package in S110 to obtain the first executable file corresponding to the sub-package may specifically include: downloading an installation package file corresponding to the sub-program package; and installing the sub program package based on the installation package file to obtain a first executable file corresponding to the sub program package.
In this disclosure, the electronic device may download the installation package file corresponding to the sub-package based on the download information of the sub-package, and install the sub-package based on the installation package file, so as to obtain the first executable file corresponding to the sub-package.
Alternatively, the download information may be information for downloading the sub-package. For example, the name of the sub package, the download address of the sub package, and the like may be included.
Alternatively, the installation package file may include all files for the installation of the sub-package.
Specifically, the electronic device may download the installation package file corresponding to the sub-package based on the download information of the sub-package, and then decompress the installation package file, so that the electronic device may search and obtain the first executable file in the decompressed installation package file.
Therefore, in the embodiment of the disclosure, the electronic device may load the sub-package to realize the loading of the relevant module in the plug-in application.
And S120, combining the first executable file with a second executable file corresponding to the application program to obtain a third executable file.
In the embodiment of the disclosure, after obtaining the first executable file, the electronic device may perform a merge operation on the first executable file and the second executable file corresponding to the application program to obtain a third executable file, so as to obtain a complete executable file corresponding to the application program, so that all files of the application program can be called in one executable file.
Optionally, S120 may specifically include: searching a second executable file corresponding to the application program; and adding the first executable file into a folder of the second executable file to obtain a third executable file.
In the embodiment of the present disclosure, after obtaining the first executable file, the electronic device may further search for a main program package in the application program, obtain a second executable file corresponding to the main program package, and further merge the first executable file and the second executable file, that is, add the first executable file to a folder of the second executable file, to obtain a third executable file.
Optionally, the second executable file is similar to the first executable file, and the second executable file may be a dex executable file in the main package, which is not described herein again.
Optionally, the third executable file may be a dex executable file obtained by merging the first executable file and the second executable file.
Specifically, after obtaining the first executable file, the electronic device may further search for a second executable file in all files corresponding to the application program, that is, search for the second executable file corresponding to the main package, obtain the second executable file after searching for the second executable file, add the first executable file to a folder of the second executable file, that is, add a plurality of class (class) files in the first executable file dex file to a plurality of class (class) files in the second executable file dex file, and then merge the first executable file and the second executable file, so as to obtain a third executable file.
Therefore, in the embodiment of the disclosure, the electronic device merges the first executable file and the second executable file to obtain the third executable file, so that the application program can run normally, and further, the functional requirements of the user are met, and the user experience is improved.
And S130, updating the file name of the target class file in the third executable file to the target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration.
In the embodiment of the disclosure, after obtaining the third executable file, the electronic device may update the file name of the target class file in the third executable file to the target file name, where the target class file may be a function class file corresponding to the sub-package in the third executable file, and may further obtain a fourth executable file.
Optionally, the target class file may be a function class file corresponding to the sub-package. The target class file may be used to register the target function.
Alternatively, the function class file may be a file for implementing a specified function.
Alternatively, the target function may be a function that can be realized by an application program. Taking an e-book application program in which the application program is a plug-in as an example, the target function may be an e-book reading function, an e-book turning function, and the like.
Alternatively, the target file name may be a file name that can be recognized by the electronic device when registering the function class file.
Specifically, after the electronic device acquires the third executable file, the electronic device may first determine a target function that needs to be registered in the sub-package, determine a corresponding function class file based on the target function, that is, a corresponding target class file, and then update a file name of the target class file, so that the file name of the target class file is updated to a target file name that can be recognized by the electronic device when the function is registered, thereby obtaining an updated fourth executable file.
And S140, registering a target function corresponding to the target class file according to the fourth executable file so as to run the application program.
In the embodiment of the present disclosure, after obtaining the fourth executable file, the electronic device may register a target function corresponding to the target class file with the updated file name in the fourth executable file, so as to run the application program based on the target function.
Specifically, after obtaining the fourth executable file, the electronic device may call and register a target class file in the fourth executable file based on the target file name, so as to obtain a target function corresponding to the target class file, and then run the application based on the target function.
Therefore, in the embodiment of the disclosure, after detecting and responding to the start operation of the application program by the user, the sub-package in the application program is loaded to obtain the first executable file corresponding to the sub-package, the first executable file is merged with the second executable file corresponding to the application program to obtain the third executable file, the file name of the target class file in the third executable file is updated to the target file name to obtain the fourth executable file, and the target function corresponding to the target class file is registered according to the fourth executable file to run the application program, because the target class file is the function class file corresponding to the sub-package and the target file name is the file name which can be identified when the function is registered, the registration of the target function corresponding to the target class file can be realized based on the target file name which can be identified, the application program can normally run, so that the functional requirements of the user are met, and the user experience is improved.
In some embodiments of the present disclosure, after receiving the start operation, the electronic device further needs to detect whether there is a sub-package to be loaded in the application program, and determine whether to load the corresponding sub-package based on a detection result, which is described in detail below.
Optionally, before loading the sub-package in the application and obtaining the first executable file corresponding to the sub-package, the method for running the application may further include: and detecting whether the application program has the sub-program package to be loaded.
In the embodiment of the disclosure, before the electronic device loads the sub package in the application program and obtains the first executable file corresponding to the sub package, it may be detected whether the sub package to be loaded exists in the application program.
Alternatively, the sub-package to be loaded may be a sub-package that needs to be loaded to start the application.
Specifically, after detecting the startup operation, the electronic device may detect the loading states of all the sub-program packages in the application program, determine that an unloaded sub-program package exists if the sub-program package exists in the loading state, and otherwise determine that the unloaded sub-program package does not exist.
Further, loading a sub-package in the application program to obtain a first executable file corresponding to the sub-package may specifically include: and loading the sub program package to obtain a first executable file corresponding to the sub program package under the condition that the sub program package is detected to exist in the application program.
In the embodiment of the disclosure, after detecting whether the sub program package to be loaded exists in the application program, if it is detected that the sub program package to be loaded exists in the application program, the electronic device may load the sub program package, and further obtain the first executable file corresponding to the sub program package.
In other embodiments, after detecting whether the sub package to be loaded exists in the application program, the electronic device may directly run the application program without loading the target class file corresponding to the sub package and registering the target function corresponding to the target class file, if it is not detected that the sub package to be loaded exists in the application program.
Therefore, in the embodiment of the disclosure, the electronic device loads the sub-program package only when the sub-program package to be loaded exists in the application program, so that the application program can normally run, the functional requirements of a user are further met, and the user experience is improved.
In other embodiments of the present disclosure, the electronic device may update the file name of the target class file in the third executable file based on a reflection mechanism, which is described in detail below.
Optionally, S130 may specifically include:
and S1301, calling the sub-program package based on a reflection mechanism.
In the embodiment of the present disclosure, after acquiring the third executable file, the electronic device may invoke the sub-package based on a reflection mechanism.
Optionally, a reflection mechanism may be used to call attribute information and a construction method corresponding to the sub-package.
Specifically, after the electronic device acquires the third executable file, multiple class files in the third executable file may be acquired through a reflection mechanism, attribute information and a construction method corresponding to the class files are acquired, and an object corresponding to the class is created based on the attribute information and the construction method, so as to call the sub-package.
S1302, analyzing the sub program package to obtain a target function list in the sub program package, wherein the target function list comprises target functions.
In the embodiment of the present disclosure, after the electronic device calls the attribute information and the construction method corresponding to the sub-package, the sub-package is analyzed, so that a target function list including a target function in the sub-package is obtained.
Specifically, after the electronic device calls the attribute information and the construction method corresponding to the sub-program package, the sub-program package may be disassembled and analyzed according to the attribute information and the construction method, the installation package corresponding to the sub-program package is disassembled into a plurality of file packages, and the file packages storing the target function list are summarized and inquired in the plurality of file packages, so that the target function list corresponding to the target function is extracted from the inquired file packages.
And S1303, updating the file name of the target class file corresponding to the target function in the third executable file to the target file name based on the target function list, and obtaining a fourth executable file.
In this embodiment of the present disclosure, after obtaining the target function list including the target function in the sub-package, the electronic device may update the file name of the target class file corresponding to the target function in the third executable file to the target file name based on the target function list, so as to obtain the fourth executable file.
Specifically, after the target function list including the target function in the sub-package is obtained, the electronic device may determine the target class file corresponding to the target function according to the target function included in the target function list, and update the file name of the target class file, so that the file name of the target class file is updated to the target file name, thereby obtaining the fourth executable file.
Further, S1303 may specifically include: determining a function name of the target function based on the target function list; in the third executable file, inquiring a target class file with a function name; and changing the package name in the file name of the target class file from the first package name corresponding to the sub-program package to the second package name corresponding to the application program so as to update the file name of the target class file to the target file name, thereby obtaining a fourth executable file.
In this disclosure, after obtaining the target function list including the target function in the sub-package, the electronic device may determine, based on the target function list, a function name of the target function included in the target function list, then, in the third executable file, search for the target class file having the function name according to the function name, and after querying the target class file, the electronic device may perform traversal, change the package name in the file name of the target class file from the first package name corresponding to the sub-package to the second package name corresponding to the application program, so that the file name of the target class file is updated to the target file name, and then obtain the fourth executable file.
Alternatively, the package name may be a name used to characterize the application to which the file belongs. The first package name can be used for representing that the file belongs to the sub-program package, and the second package name can be used for representing that the file belongs to the application program of the sub-program package.
Specifically, after acquiring a target function list including target functions in a sub-package, the electronic device traverses the target function list, that is, first, starting from a first target function in the target function list, determines the first target function, and queries a target class file corresponding to the first target function in a third executable file, changes a package name in a file name of the target class file from a first package name corresponding to the sub-package to a second package name corresponding to an application program, then, determines a second target function from the target function list, and queries a target class file corresponding to the second target function in the third executable file, changes a package name in a file name of the target class file from a first package name corresponding to the sub-package to a second package name corresponding to the application program, and sequentially updates, so that file names of target class files corresponding to all target functions in the target function list are updated to target file names corresponding to the application programs, thereby obtaining a fourth executable file.
Therefore, in the embodiment of the disclosure, the file name of the target class file corresponding to the target function in the sub-package is updated to the target file name, so that the file name of the target class file updated to the target file name can be identified during registration, the target function corresponding to the target class file can be successfully registered, the application program can normally run, the functional requirements of the user are met, and the user experience is improved.
In still other embodiments of the present disclosure, the targeting functions may include content provider functions and/or content recipient functions.
In some embodiments, the target function may comprise a content provider function and the target class file corresponding to the target function may comprise a class file of the content provider function.
Optionally, S140 may specifically include: acquiring an active thread corresponding to a target function; and calling a target class file in the fourth executable file according to the target file name through the activity thread so as to register the target function.
In this embodiment of the present disclosure, after the electronic device acquires the target function list including the target function in the sub-package, a Content Provider (Content Provider) function included in the target function may be acquired, and a class file corresponding to the Content Provider function may be included in a target class file corresponding to the target function.
Further, the electronic device may obtain an activity thread corresponding to the target function, and call the target class file in the fourth executable file according to the target file name through the activity thread to register the target function.
Alternatively, the active thread may be a thread that registers for a target function.
Specifically, after acquiring the target function, the electronic device may newly create an active thread, and then acquire a main thread (ActivityThread), where the main thread may be an entry of the active thread, and after acquiring the main thread, the electronic device may call a component, such as a ContentProvider component, in the active thread, and call a target class file in a fourth executable file corresponding to the target file name through the component to register the target function.
Therefore, in the embodiment of the disclosure, the electronic device can register the target function, so that the application program can run normally, the functional requirements of the user are met, and the user experience is improved.
In other embodiments, the target function may comprise a content recipient function and the target class file may comprise a class file for the content recipient function.
Optionally, registering the target function corresponding to the target class file according to the target file name may specifically include: and registering the target function corresponding to the target class file in the fourth executable file through a native registration mode corresponding to the application program.
In this embodiment of the present disclosure, the electronic device may further obtain a content receiver (broadcastrepeat) function included in the target function, and a class file corresponding to the content receiver function may be included in the target class file corresponding to the target function.
Further, the electronic device may register a target function corresponding to the target class file in the fourth executable file through a native registration manner corresponding to the application program.
Alternatively, the native registration mode may be a broadcastereiver dynamic registration mode.
Specifically, after acquiring the target class file in the fourth executable file, the electronic device may register the target function corresponding to the target class file in a native registration manner based on the target class file.
In still other embodiments, the target function may include a content provider function and a content receiver function, and the target class file corresponding to the target function may include a class file for the content provider function and a class file for the content receiver function.
In this embodiment of the disclosure, after the electronic device acquires the target function list including the target function in the sub-package, the electronic device may acquire a Content Provider (Content Provider) function included in the target function, and a class file corresponding to the target function may include a class file corresponding to the Content Provider function, and the electronic device may further acquire a Content receiver (broadcastdetect) function included in the target function, and a class file corresponding to the Content receiver function may be included in a target class file corresponding to the target function.
Further, the electronic device may obtain an activity thread corresponding to the target function, and call the target class file in the fourth executable file according to the target file name through the activity thread to register the target function, and may also register the target function corresponding to the target class file in the fourth executable file through a native registration manner corresponding to the application program, which is referred to above in the specific embodiment and is not described herein again.
Therefore, in the embodiment of the disclosure, the electronic device can register the target function, so that the application program can run normally, the functional requirements of the user are met, and the user experience is improved.
The detailed flow corresponding to the content provider function and the content receiver function is described in detail below with reference to fig. 2 and 3.
Fig. 2 is a flowchart illustrating a content provider function registration method according to an embodiment of the present disclosure.
As shown in fig. 2, the content provider function registration method may include the following steps.
And S210, acquiring the class to be loaded.
In an embodiment of the present disclosure, the electronic device may obtain a class to be loaded.
Alternatively, the class to be loaded may be a class for loading class files. For example, the PackageParser class.
And S220, acquiring a class file corresponding to the class to be loaded.
In the embodiment of the present disclosure, after acquiring the class to be loaded, the electronic device loads the class to obtain the class file corresponding to the class to be loaded.
And S230, acquiring a list file comprising the content provider function.
In the embodiment of the present disclosure, after acquiring the class file, the electronic device acquires the list file including the content provider function in the class file.
And S240, acquiring the target function in the list file.
In the embodiment of the present disclosure, after acquiring the list file, the electronic device acquires the target function included in the list file.
And S250, registering the target function based on the active thread.
In the embodiment of the present disclosure, after acquiring the target function, the electronic device registers the target function based on the active thread.
For the detailed description, reference is made to the above description.
Fig. 3 shows a flowchart of a content recipient function registration method according to an embodiment of the present disclosure.
As shown in fig. 3, the content receiver function registration method may include the following steps.
And S310, newly building a target interface.
In the embodiment of the present disclosure, the electronic device may newly establish a target interface.
Alternatively, the target interface may be an interface for enabling registration of the target function.
And S320, calling a native registration method.
In the embodiment of the disclosure, after a new target interface is created, the electronic device may call a native registration method in an application program.
S330, the acquired class file comprises a list file corresponding to the function of the content receiver.
In the embodiment of the disclosure, after the electronic device calls the native registration method, the electronic device obtains the list file including the content receiver function.
And S340, acquiring the target function file in the list.
In the embodiment of the present disclosure, after acquiring the list file, the electronic device acquires the target function included in the list file.
And S350, registering the target function based on the native registration method.
In the embodiment of the present disclosure, after acquiring the target function, the electronic device registers the target function based on the native registration method and the target interface.
For the detailed description, reference is made to the above description.
An operation method of the application program provided in the embodiment of the present disclosure is exemplarily described below with reference to fig. 4.
Fig. 4 is a flowchart illustrating an operation method of another application program according to an embodiment of the present disclosure.
As shown in fig. 4, the method for running the application program may include the following steps.
And S410, detecting the starting operation of the application program.
In the embodiment of the present disclosure, when a user wants to start an application program in an electronic device, a start operation of the application program may be input to the electronic device. The electronic device may detect the initiation operation.
And S420, detecting whether the sub program package to be loaded exists in the application program.
In the embodiment of the disclosure, after detecting the start operation, the electronic device may detect whether there is a sub-package to be loaded in the application program.
And S430, loading the sub program package under the condition that the sub program package exists in the application program, and obtaining a first executable file corresponding to the sub program package.
In the embodiment of the disclosure, after detecting whether the sub program package to be loaded exists in the application program, if it is detected that the sub program package to be loaded exists in the application program, the electronic device may load the sub program package, and further obtain the first executable file corresponding to the sub program package.
S440, searching a second executable file corresponding to the application program.
In the embodiment of the disclosure, after obtaining the first executable file, the electronic device may further search for a second executable file corresponding to the application program, and obtain the searched second executable file.
S450, combining the first executable file with a second executable file corresponding to the application program to obtain a third executable file.
In the embodiment of the disclosure, after obtaining the first executable file and the second executable file, the electronic device may add the first executable file to a folder of the second executable file, so as to obtain a third executable file.
And S460, updating the file name of the target class file in the third executable file to the target file name to obtain a fourth executable file.
In the embodiment of the present disclosure, after obtaining the third executable file, the electronic device may update the file name of the target class file in the third executable file to the target file name. Resulting in a fourth executable file.
And S470, if the target function comprises the content provider function, registering the target function corresponding to the target class file according to the fourth executable file so as to run the application program.
In this disclosure, if the target function includes a content provider function, the electronic device may register a target function corresponding to the target class file according to the fourth executable file to run the application program.
And S480, if the target function comprises the content receiver function, registering the target function corresponding to the target class file according to the target file name.
In this disclosure, if the target function includes a content receiver function, the electronic device may register a target function corresponding to the target class file according to the target file name.
Optionally, the detailed description of each step in fig. 4 refers to the above, and is not repeated here.
Therefore, in the embodiment of the disclosure, the target function corresponding to the target class file can be registered, so that the application program can run normally, the functional requirements of the user are met, and the user experience is improved.
Fig. 5 shows a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.
The electronic devices provided by the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as smart phones, notebook computers, PDAs, PADs, PMPs, in-vehicle terminals (e.g., car navigation terminals), wearable devices, and the like, and fixed terminals such as digital TVs, desktop computers, smart home devices, and the like.
It should be noted that the electronic device 500 shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of the embodiments of the present disclosure.
The electronic device 500 conventionally includes a processor 510 and a computer program product or computer-readable medium in the form of a memory 520. The memory 520 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. The memory 520 has a memory space 521 for executable instructions (or program code) 5211 for performing any of the method steps in the note processing method described above. For example, the memory space 521 for executable instructions may include respective executable instructions 5211 for implementing various steps in the note processing method above, respectively. The executable instructions may be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, a Compact Disc (CD), a memory card or a floppy disk. Such computer program products are typically portable or fixed storage units. The memory unit may have memory segments or memory spaces or the like arranged similarly to the memory 520 in the electronic device 500 of fig. 5. The executable instructions may be compressed, for example, in a suitable form. In general, the memory unit includes executable instructions for performing the steps of the note processing method according to the present disclosure, i.e., code that is readable by, for example, a processor such as the processor 510, which when executed by the electronic device 500, causes the electronic device 500 to perform the various steps of the note processing method described above.
Of course, for simplicity, only some of the components of the electronic device 500 relevant to the present disclosure are shown in fig. 5, and components such as buses, input/output interfaces, input devices, and output devices, etc. are omitted. In addition, the electronic device 500 may include any other suitable components depending on the particular application.
The disclosed embodiments also provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the processor executes an execution method of an application program provided by the disclosed embodiments.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical link having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
In embodiments of the present disclosure, program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be linked to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the link may be made to an external computer (for example, through the Internet using an Internet service provider).
The application discloses:
a1, an application program running method, wherein the method comprises the following steps:
in response to the detection of the starting operation of the application program, loading a sub-program package in the application program to obtain a first executable file corresponding to the sub-program package;
merging the first executable file and a second executable file corresponding to the application program to obtain a third executable file;
updating the file name of a target class file in the third executable file to a target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration;
and according to the fourth executable file, registering a target function corresponding to the target class file so as to run the application program.
A2, the method according to claim a1, wherein before the sub package in the application program is loaded and the first executable file corresponding to the sub package is obtained, the method further comprises:
detecting whether a sub-program package to be loaded exists in an application program;
the loading of the sub-program package in the application program to obtain the first executable file corresponding to the sub-program package includes:
and loading the sub program package to obtain a first executable file corresponding to the sub program package under the condition that the sub program package is detected to exist in the application program.
A3, the method of claim a2, wherein loading the sub package to obtain the first executable file corresponding to the sub package comprises:
downloading an installation package file corresponding to the sub-program package;
and installing the sub program package based on the installation package file to obtain a first executable file corresponding to the sub program package.
A4, the method of claim a1, wherein merging the first executable file with the second executable file corresponding to the application program to obtain the third executable file comprises:
searching a second executable file corresponding to the application program;
and adding the first executable file into a folder of the second executable file to obtain a third executable file.
A5 the method according to claim a1, wherein the updating the file name of the target class file in the third executable file to the target file name, resulting in a fourth executable file, comprises:
calling the sub-program package based on a reflection mechanism;
analyzing the sub-program package to obtain a target function list in the sub-program package, wherein the target function list comprises target functions;
and updating the file name of the target class file corresponding to the target function in the third executable file to the target file name based on the target function list to obtain a fourth executable file.
A6, the method according to claim a5, wherein the updating the file name of the target class file corresponding to the target function in the third executable file to the target file name based on the target function list, and obtaining a fourth executable file, includes:
determining a function name of the target function based on the target function list;
in the third executable file, inquiring a target class file with a function name;
and changing the package name in the file name of the target class file from the first package name corresponding to the sub-program package to the second package name corresponding to the application program so as to update the file name of the target class file to the target file name, thereby obtaining a fourth executable file.
A7, the method according to claim a1, wherein the target functions include content provider functions and/or content receiver functions.
A8, the method according to claim a1, wherein the target function includes a content provider function, the target class file includes a class file of the content provider function;
according to the fourth executable file, registering a target function corresponding to the target class file, including:
acquiring an active thread corresponding to a target function;
and calling the target class file in the fourth executable file according to the target file name through the activity thread so as to register the target function.
A9, the method according to claim a1, wherein the target function includes a content receiver function, the target class files include class files of the content receiver function;
according to the target file name, registering a target function corresponding to the target class file, wherein the target function comprises the following steps:
and registering the target function corresponding to the target class file in the fourth executable file through a native registration mode corresponding to the application program.
B10, an electronic device, comprising a processor and a memory, the memory storing executable instructions, the executable instructions causing the processor to:
in response to the detection of the starting operation of the application program, loading a sub-program package in the application program to obtain a first executable file corresponding to the sub-program package;
merging the first executable file and a second executable file corresponding to the application program to obtain a third executable file;
updating the file name of a target class file in the third executable file to a target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration;
and according to the fourth executable file, registering a target function corresponding to the target class file so as to run the application program.
B11, the electronic device according to claim B10, wherein the executable instructions further cause the processor to perform, before the sub-package in the application is loaded and the first executable file corresponding to the sub-package is obtained:
detecting whether a sub-program package to be loaded exists in an application program;
when the sub-package in the application program is loaded and the first executable file corresponding to the sub-package is obtained, the executable instruction specifically causes the processor to execute:
and loading the sub program package to obtain a first executable file corresponding to the sub program package under the condition that the sub program package is detected to exist in the application program.
B12, the electronic device of claim B11, wherein when the sub package is loaded to obtain the first executable file corresponding to the sub package, the executable instructions specifically cause the processor to perform:
downloading an installation package file corresponding to the sub-program package;
and installing the sub program package based on the installation package file to obtain a first executable file corresponding to the sub program package.
B13, the electronic device of claim B10, wherein when the first executable file is merged with the second executable file corresponding to the application program to obtain the third executable file, the executable instructions specifically cause the processor to:
searching a second executable file corresponding to the application program;
and adding the first executable file into a folder of the second executable file to obtain a third executable file.
B14, the electronic device according to claim B10, wherein when the file name of the target class file in the third executable file is updated to the target file name, and a fourth executable file is obtained, the executable instructions specifically cause the processor to perform:
calling the sub-program package based on a reflection mechanism;
analyzing the sub-program package to obtain a target function list in the sub-program package, wherein the target function list comprises target functions;
and updating the file name of the target class file corresponding to the target function in the third executable file to the target file name based on the target function list to obtain a fourth executable file.
B15, the electronic device of claim B14, wherein, when the file name of the target class file corresponding to the target function in the third executable file is updated to the target file name based on the target function list, and a fourth executable file is obtained, the executable instructions specifically cause the processor to perform:
determining a function name of the target function based on the target function list;
in the third executable file, inquiring a target class file with a function name;
and changing the package name in the file name of the target class file from the first package name corresponding to the sub-program package to the second package name corresponding to the application program so as to update the file name of the target class file to the target file name, thereby obtaining a fourth executable file.
B16, the electronic device according to claim B10, wherein the target functionality comprises content provider functionality and/or content receiver functionality.
B17, the electronic device according to claim B10, wherein the target function includes a content provider function, the target class file includes a class file of the content provider function;
when the target function corresponding to the target class file is registered according to the fourth executable file, the executable instruction specifically causes the processor to execute:
acquiring an active thread corresponding to a target function;
and calling a target class file in the fourth executable file according to the target file name through the activity thread so as to register the target function.
B18, the electronic device according to claim B10, wherein the target function includes a content receiver function, and the target class file includes a class file of the content receiver function;
when the target function corresponding to the target class file is registered according to the target file name, the executable instruction specifically causes the processor to execute:
and registering the target function corresponding to the target class file in the fourth executable file through a native registration mode corresponding to the application program.
C19, a computer readable storage medium, wherein the storage medium stores a computer program which, when executed by a processor, causes the processor to carry out a method of running an application program according to any one of the preceding claims a1-a 9.
Various component embodiments of the disclosure may be implemented in whole or in part in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components in an electronic device according to embodiments of the present disclosure. The present disclosure may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present disclosure may be stored on a computer-readable medium or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. An application program running method, comprising:
in response to the detection of the starting operation of the application program, loading a sub program package in the application program to obtain a first executable file corresponding to the sub program package;
merging the first executable file and a second executable file corresponding to the application program to obtain a third executable file;
updating the file name of a target class file in the third executable file to a target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration;
and according to the fourth executable file, registering a target function corresponding to the target class file so as to run the application program.
2. The method according to claim 1, wherein before the sub-package in the application program is loaded and the first executable file corresponding to the sub-package is obtained, the method further comprises:
detecting whether the sub program package to be loaded exists in the application program;
the loading of the sub program package in the application program to obtain the first executable file corresponding to the sub program package includes:
and loading the sub program package under the condition that the sub program package exists in the application program, so as to obtain a first executable file corresponding to the sub program package.
3. The method of claim 1, wherein merging the first executable file with a second executable file corresponding to the application program to obtain a third executable file comprises:
searching a second executable file corresponding to the application program;
and adding the first executable file into a folder of the second executable file to obtain the third executable file.
4. The method according to claim 1, wherein the updating the file name of the target class file in the third executable file to the target file name to obtain a fourth executable file comprises:
calling the sub-program package based on a reflection mechanism;
analyzing the sub program package to obtain a target function list in the sub program package, wherein the target function list comprises the target function;
and updating the file name of the target class file corresponding to the target function in the third executable file to the target file name based on the target function list to obtain the fourth executable file.
5. The method according to claim 4, wherein the updating the file name of the target class file corresponding to the target function in the third executable file to the target file name based on the target function list to obtain the fourth executable file comprises:
determining a function name of the target function based on the target function list;
querying the target class file with the function name in the third executable file;
and changing the package name in the file name of the target class file from the first package name corresponding to the sub-program package to the second package name corresponding to the application program so as to update the file name of the target class file to the target file name, thereby obtaining the fourth executable file.
6. The method of claim 1, wherein the target function comprises a content provider function and/or a content recipient function.
7. The method of claim 1, wherein the target function comprises a content provider function, and wherein the target class file comprises a class file of the content provider function;
wherein, registering the target function corresponding to the target class file according to the fourth executable file includes:
acquiring an active thread corresponding to the target function;
and calling the target class file in the fourth executable file according to the target file name through the activity thread so as to register the target function.
8. The method of claim 1, wherein the target function comprises a content recipient function, and wherein the target class file comprises a class file for the content recipient function;
wherein, registering the target function corresponding to the target class file according to the target file name comprises:
and registering a target function corresponding to the target class file in the fourth executable file through a native registration mode corresponding to the application program.
9. An electronic device comprising a processor and a memory, the memory to store executable instructions that cause the processor to:
in response to the detection of the starting operation of the application program, loading a sub program package in the application program to obtain a first executable file corresponding to the sub program package;
merging the first executable file and a second executable file corresponding to the application program to obtain a third executable file;
updating the file name of a target class file in the third executable file to a target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-package, and the target file name is a file name which can be identified during function registration;
and according to the fourth executable file, registering a target function corresponding to the target class file so as to run the application program.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, causes the processor to carry out a method of running an application according to any one of the preceding claims 1-8.
CN202210456071.7A 2022-04-27 2022-04-27 Application program running method, electronic equipment and storage medium Pending CN114860335A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210456071.7A CN114860335A (en) 2022-04-27 2022-04-27 Application program running method, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210456071.7A CN114860335A (en) 2022-04-27 2022-04-27 Application program running method, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114860335A true CN114860335A (en) 2022-08-05

Family

ID=82632886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210456071.7A Pending CN114860335A (en) 2022-04-27 2022-04-27 Application program running method, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114860335A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329788A (en) * 2017-06-29 2017-11-07 广州优视网络科技有限公司 application program loading method, device and user terminal
CN108681473A (en) * 2018-05-18 2018-10-19 广州酷狗计算机科技有限公司 Application program generation, operation method, device, computer equipment and storage medium
CN112083968A (en) * 2020-08-27 2020-12-15 腾讯科技(深圳)有限公司 Plug-in loading method and device in host

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329788A (en) * 2017-06-29 2017-11-07 广州优视网络科技有限公司 application program loading method, device and user terminal
CN108681473A (en) * 2018-05-18 2018-10-19 广州酷狗计算机科技有限公司 Application program generation, operation method, device, computer equipment and storage medium
CN112083968A (en) * 2020-08-27 2020-12-15 腾讯科技(深圳)有限公司 Plug-in loading method and device in host

Similar Documents

Publication Publication Date Title
US9098370B2 (en) Apparatus and methods for improving uninstall process
CN108984225B (en) Method and device for quickly starting hosted application
CN107534685B (en) Business processing method and device, readable storage medium and chip system
CN108595218B (en) Method and device for loading dynamic library of system
CN111666497A (en) Application program loading method and device, electronic equipment and readable storage medium
CN109800030B (en) Application program running method and device and terminal
CN105512294A (en) Multi-media file update prompting method and device
CN112559069B (en) Running control method and device of sub-application, storage medium and electronic equipment
CN109117153B (en) Application processing method, device, terminal and storage medium
CN111666516A (en) Page loading method and device, electronic equipment and storage medium
CN110221877B (en) Application program running method and device, electronic equipment and storage medium
CN111935694A (en) Bluetooth device connection method and device, electronic device and readable storage medium
CN110825481A (en) Method and device for displaying page information corresponding to page tag and electronic equipment
CN112383623B (en) Multimedia file processing method and device, terminal and network access point equipment
CN113761588A (en) Data verification method and device, terminal equipment and storage medium
CN112256351A (en) Implementation method of Feign component, micro-service calling method and device
CN114860335A (en) Application program running method, electronic equipment and storage medium
CN108268274B (en) Application management method and device, storage medium and electronic equipment
US20170277528A1 (en) Application installation system and method for handheld devices
CN108959553A (en) A kind of URL update method, device and electronic equipment
CN113704281A (en) Data format conversion method and device, storage medium and electronic equipment
CN110489679B (en) Browser kernel processing method and device and storage medium
CN112835671A (en) Application page scene switching method, device and equipment
CN115004667A (en) Information pushing method and device, electronic equipment and computer readable medium
CN111796865A (en) Byte code file modification method and device, terminal equipment and medium

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