Disclosure of Invention
The embodiment of the disclosure at least provides a method, a device and a computer storage medium for running an application.
In a first aspect, an embodiment of the present disclosure provides a method for running an application, the method including:
Downloading an installation package of the target subprogram through the target application program;
acquiring a code file and a resource file of the target subprogram based on the installation package;
and respectively configuring the code file and the resource file under the corresponding directory of the target application program, and respectively redirecting the access paths of the code file and the resource file so as to call the code file and the resource file in the target application program and run the target subprogram through the redirected access paths.
In one possible implementation manner, the acquiring, based on the installation package, a code file and a resource file of the target subroutine includes:
based on the type of the application binary interface ABI corresponding to the target application program, decompressing from the installation package to obtain a code file corresponding to the type of the ABI;
and taking the files except the code file in the installation package as the resource file.
In one possible implementation, the target subroutine is a game program.
In one possible implementation manner, the configuring the code file and the resource file under the corresponding directory of the target application program respectively, and redirecting the access paths of the code file and the resource file respectively includes:
And respectively storing the code file and the resource file under different storage directories corresponding to the target subprogram code in the target application program, and respectively modifying access paths of the code file and the resource file.
In one possible implementation, the modifying the access path of the code file includes:
and adding a storage catalog of the code file in the target application program to the forefront position of the searching path of the code file by adopting a preset path modification mechanism.
In one possible implementation manner, after the redirecting the access paths of the code file and the resource file respectively, the method further includes:
and responding to a starting instruction aiming at the target subprogram, starting the game engine in the target application program based on the accessed code of the game engine, and calling other codes of the code file and the resource file through the game engine to run the target subprogram.
In one possible implementation manner, before the downloading, by the target application program, the installation package of the target sub program, the method further includes:
acquiring the running environment information of the target subprogram on the target application program;
Based on the running environment information, downloading a container plug-in corresponding to the target subprogram and installing the container plug-in on the target application program; the container plug-in is used for executing the process of downloading the installation package of the target subprogram, acquiring the code file and the resource file and redirecting the access path.
In a second aspect, embodiments of the present disclosure further provide an apparatus for running an application, where the apparatus includes:
and the downloading module is used for downloading the installation package of the target subprogram through the target application program.
And the acquisition module is used for acquiring the code file and the resource file of the target subprogram based on the installation package.
And the configuration module is used for respectively configuring the code file and the resource file under the corresponding directory of the target application program, and respectively redirecting the access paths of the code file and the resource file so as to call the code file and the resource file in the target application program and run the target subprogram through the redirected access paths.
In a possible implementation manner, the obtaining module is specifically configured to decompress, based on a type of an application binary interface ABI corresponding to the target application, from the installation package to obtain a code file corresponding to the type of the ABI; and taking the files except the code file in the installation package as the resource file.
In one possible implementation, the target subroutine is a game program.
In a possible implementation manner, the configuration module is specifically configured to store the code file and the resource file in different storage directories corresponding to the target subroutine in the target application program, and modify access paths of the code file and the resource file, respectively.
In a possible implementation manner, the configuration module is further specifically configured to add a storage directory of the code file in the target application program to a foremost position of a search path of the code file by adopting a preset path modification mechanism.
In one possible implementation, the apparatus further includes a response module, configured to respond to a start instruction for the target subroutine, start the game engine in the target application program based on the accessed code of the game engine, and call other codes of the code file and the resource file through the game engine to run the target subroutine.
In a possible implementation manner, the device further comprises a plug-in acquisition module, which is specifically configured to acquire the running environment information of the target sub-program on the target application program; based on the running environment information, downloading a container plug-in corresponding to the target subprogram and installing the container plug-in on the target application program; the container plug-in is used for executing the process of downloading the installation package of the target subprogram, acquiring the code file and the resource file and redirecting the access path.
In a third aspect, embodiments of the present disclosure further provide a computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect, or any of the possible implementations of the first aspect.
In a fourth aspect, the presently disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the first aspect, or any of the possible implementations of the first aspect.
The method, the device and the computer storage medium for running the application provided by the embodiment of the disclosure are characterized in that the installation package of the target subprogram is downloaded through the target application program, the code file and the resource file of the target subprogram are obtained based on the installation package, the code file and the resource file are respectively configured under the corresponding directory of the target application program, and the access paths of the code file and the resource file are respectively redirected, so that the code file and the resource file can be called in the target application program through the redirected access paths, and the target subprogram is run; in the embodiment of the disclosure, the target subprogram can be directly stored and access path redirected through the target application program without local installation of the subprogram installation package, so that the target subprogram can be directly operated in the target application program, the installation process is omitted, and the operation process of the target subprogram is simple and convenient.
The foregoing objects, features and advantages of the disclosure will be more readily apparent from the following detailed description of the preferred embodiments taken in conjunction with the accompanying drawings.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. The components of the embodiments of the present disclosure, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be made by those skilled in the art based on the embodiments of this disclosure without making any inventive effort, are intended to be within the scope of this disclosure.
For games developed by using a game engine, a user is generally required to download a corresponding installation package through a download link, and install the downloaded installation package after the downloading is completed; after installation, when the user accesses the software, a series of operations such as software registration, login, authority setting and the like are required to be performed so as to experience the game.
In order to simplify the user operation, operations such as installation, software registration, login, authority setting and the like are omitted, and related games are directly operated in a target application program (the target application program can be called as a host APP of related game software) which is currently operated; before the embodiment of the application is proposed, the game engine can be recompiled to adapt to the target application program, and the recompiled game engine is used for redevelopment and release of the game item; and correspondingly modifying the target application program for running the game, so that the reconstructed game item can be directly run in the modified target application program. However, the above method for directly running the game in the host requires modification of the code of the game engine, which makes development difficult, and requires modification of the game engines of different versions, which is too costly to develop.
Therefore, based on the above-mentioned study, the embodiment of the present disclosure provides a method for running an application, where a code file and a resource file of a target sub-program may be obtained by downloading an installation package of the target sub-program by the target application program, and then the code file and the resource file are respectively configured under a corresponding directory of the target application program, and access paths of the code file and the resource file are respectively redirected. After the installation package of the target subprogram is obtained through the target application program, the code file and the resource file are respectively configured under the corresponding directory of the target application program, and the access paths of the code file and the resource file are respectively redirected, so that the operation of the target subprogram is realized, the operation process of the target subprogram is simple, and when the target subprogram comprises a small game, the embodiment of the invention does not depend on the modification of the function code of the game engine, and has the advantages of low development difficulty and low cost.
The present invention is directed to a method for manufacturing a semiconductor device, and a semiconductor device manufactured by the method.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
For the sake of understanding the present embodiment, first, a detailed description will be given of a method for executing an application disclosed in an embodiment of the present disclosure, where an execution body of the method for executing an application provided in an embodiment of the present disclosure is generally a computer device having a certain computing capability, where the computer device includes, for example: the terminal device or server or other processing device may be a User Equipment (UE), a mobile device, a User terminal, a personal digital assistant (Personal Digital Assistant, PDA), or the like. In some possible implementations, the method of application execution may be implemented by way of a processor invoking computer readable instructions stored in a memory.
In the following, several technical terms related to the present disclosure will be explained first.
Game engine, which refers to the core components of some compiled editable computer game systems or some interactive real-time image applications. These systems provide game designers with the various tools required to write games in order to allow the game designer to easily and quickly make game programs without starting from zero. The game engine is a set of codes (instructions) designed for the machine running a certain game and capable of being identified by the machine, and controls the running of the game; here, a game work may be divided into two major parts of a game engine and a game resource, the game resource including image, sound, animation, and the like; here, the following formula can be used: game = engine (program code) +resources (images, sounds, animations, etc.); the game engine calls these resources sequentially as required by the game design.
The Android application installation package (Android application package, APK) is an application package text format used by an Android (Android) operating system, the code is compiled, resources are compressed, and then the APK can be built by using an item automation building tool, and all contents of an Android application are contained in the APK, for example, an APK file of a game item can specifically include a code file (a dynamic library file (here, the dynamic library file is a game code file built based on a game engine and used for realizing the game item), a code of the game engine), a resource file (wherein the resource file can include a picture resource, a video resource, an audio resource and the like), and the like.
Application binary interfaces (Application Binary Interface, ABI), each operating system provides an application binary interface for an application running under the system, the ABI containing programming conventions that the application must adhere to when running under the system. On the Android system, the ABI corresponding to the CPU can comprise armeabi, armeabi-v7a, x86, mips, arm64-v8a, mips64, x86_64 and the like; when an application is installed on a device that applies the Android system, only the dynamic library file (also called the so file) corresponding to the ABI provided by the device will be installed.
In the Android system, android application installation generally involves the following categories: app directory under system directory (system/app): the catalog contains a plurality of application programs of the system, and a user cannot delete the application programs; app directory (data/app) under data directory: for an installation catalog of a user program (the user program is one of two types of application software and is software provided for meeting application requirements of different fields and different problems of a user), the application program which is installed by the user is generally under the catalog, a subprogram storage catalog (the subprogram storage catalog is used for storing APK compressed package files of subprograms downloaded by the user through the application program) corresponding to each installed application program is created under the installation catalog, and the user has a deletion authority; data directory (data/data) under data directory: the catalog is used for storing data of installed application programs, and a subprogram code loading catalog (the subprogram code loading catalog is used for storing code files of subprograms downloaded by a user through the application programs) corresponding to each installed application program is created under the catalog.
If an APK needs to be installed locally, the system copies the APK compressed package file to the data/app directory, creates a subroutine storage directory (here, the subroutine storage directory is used for storing the APK compressed package file of the subroutine downloaded by the user through the application program), decompresses and scans the APK compressed package file, decompresses a dynamic library file corresponding to the ABI of the Android system to the data/lib directory, saves a dex file (i.e. a dalvik byte code) in the APK to the data/dalvik-cache directory, and creates a subroutine code loading directory corresponding to the application program under the data/data directory.
The container plug-in is a program written by an application program interface conforming to a certain specification, can only run under a system platform specified by the application program, can simultaneously support a plurality of system platforms, cannot independently run when being separated from a specified system platform, and is used for downloading APK (application program interface) adapted to the currently supported system platform.
The method for running the application provided by the embodiment of the present disclosure is described below by taking the execution body as the terminal device as an example.
Example 1
In specific implementation, the game can be run in the target application program by means of rewriting, reflection, hook function hook and the like under the condition that the game engine code is not modified; here, a target Application (APP) may be used as a host APP, the host APP downloads a container plug-in from a plug-in server, and the APK compression package file of the game item matched with the container plug-in is downloaded and managed through the container plug-in, so that the game item can be directly run in the host APP, thereby implementing that the user can directly experience the game in the host APP without installing the game APP, which is described in detail below.
Referring to fig. 1, a flowchart of a method for running an application according to an embodiment of the present disclosure may be applied to the field of games, where the method includes steps S101 to S103, where:
s101, downloading an installation package of the target subprogram through the target application program.
The target application program is a host APP, and can be an APP installed on electronic equipment such as a mobile phone, a tablet computer and the like; the target subprogram can be a game program, and the target subprogram can be a target game downloaded by a user through related introduction information and download links pushed by a host APP. In the embodiment of the present disclosure, a specific description will be given by taking a target subroutine as an example of a target game.
Here, the installation package of the target game is an APK compressed package file of the target game, and the installation package may include: a dynamic library file matching each of the plurality of CPU architectures, and a game engine and game resources; the game resources can comprise a plurality of resources such as picture resources, video resources, audio resources and the like; the CPU architecture may be armeabi, armeabi-v7a, x86, mips, arm64-v8a, mips64, x86_64, etc.
In a specific implementation, the host APP may download a container plug-in from the plug-in server, download and manage an APK compressed package file of a target game item matched with the container plug-in through the container plug-in, and obtain the container plug-in through the following method, which is specifically described as follows: acquiring the running environment information of a target subprogram on a target application program; and based on the running environment information, downloading the container plug-in corresponding to the target subprogram and installing the container plug-in on the target application program.
On the target application program, the process of downloading the installation package of the target sub program, and obtaining the code file and the resource file of the installation package of the target sub program and redirecting the access path in the following steps S102-S103 is performed through the installed container plug-in.
The running environment information may include operating system information supported by the game, hardware configuration information corresponding to running the game device, running library information required in the running process of the game, an application programming interface (Application Programming Interface, API) of the target game, a CPU architecture corresponding to running the game device, and the like.
The container plug-in is a program written by an application program interface conforming to a certain standard; the container plug-in is typically obtained through a cloud service or a remote server.
Specifically, the target application program downloads a container plug-in matched with the API of the target game from the plug-in server, installs the container plug-in on the target application program, acquires an APK compression package file of the target game matched with the container plug-in the container cloud service, and stores the APK compression package file of the target game in a storage catalog of a subprogram of the target application program (namely, under a target game exclusive catalog in the subprogram storage catalog of the target application program, namely, under a root catalog/data/app/target application program name/target game name catalog).
Here, the subroutine storage directory of the target application is: the directory of APK compression package files which is created under the target application program directory and used for storing the subprogram downloaded by the user through the target application program; here, the subroutine storage directory of the target application includes: a subroutine-specific directory named by the name of the subroutine downloaded by the target application.
Here, since the game program is described in detail by taking the subroutine downloaded through the target application as an example in the embodiment of the present disclosure, the target game-dedicated directory named by the name of the target game is contained in the subroutine storage directory of the target application.
In a specific implementation, after the installation package of the target sub-program is obtained and downloaded in the target application program through the container plug-in according to step S101, the container plug-in may process the saved installation package of the target sub-program through step S102, which is described in detail below.
S102, acquiring a code file and a resource file of the target subprogram based on the installation package.
The code file comprises a dynamic library file and a code file of a game engine, wherein the dynamic library file and the code file are respectively matched with a plurality of CPU architectures; the resource file may contain game resources of the target game. Here, the code required for running the target game may be contained in the dynamic library file; the game resources may include pictures, audio, video, etc. resources required by the target game at runtime.
Here, ABI is an interface for information interaction between an application program and an operating system, and between an application program and a runtime library; an APP generally installed on a mobile phone, a tablet personal computer and other equipment can communicate with a system through an ABI corresponding to the APP, call various function functions of the system, and call various operation libraries required by operation through the ABI.
Under the general condition, if the target game APP is locally downloaded and installed, the dynamic library file of the target game is decompressed from the APK compression package file of the target game to the system installation catalog (namely under the root catalog/data/lib catalog), and when the target game APP is operated, the game engine of the target game APP can directly search and call the dynamic library file of the target game in the folder under the system installation catalog; in the embodiment of the present disclosure, the target game APP is not installed, so the container plug-in acquired in step S101 needs to extract the dynamic library file and the game engine code file in the installation package of the target game APP, store the extracted dynamic library file and the game engine code file in the storage directory corresponding to the target sub-program in the target application program (i.e., the sub-program code named by the target game name in the target application program is loaded in the directory, i.e., the root directory/data/APP/target application name/target game name directory), and use the ABI corresponding to the host APP as an interface for communicating with the system for the target game, so that the target game can be run even if the target game APP is not installed.
Here, the subroutine code loading directory is: the target application program catalog is created for storing the catalog of the code files of the subprogram downloaded by the user through the target application program.
The subprogram downloaded through the target application program may be a game program.
In summary, the code file required for running the target game needs to be decompressed from the installation package of the target game according to the ABI type of the target application.
Here, the ABI types may include 32 bits armeabi, armeabi-v7a, x86, mips and 64 bits arm64-v8a, mips64, x86_64.
Specifically, a container plug-in installed on a target application program decompresses a dynamic library file matched with the ABI type of the target application program from an installation package of a target game, and decompresses a game engine code in the installation package of the target game to obtain a code file containing the dynamic library file and the game engine code; and taking the files except the code file in the installation package as resource files.
In a specific implementation, after determining the code file and the resource file in the installation package of the target game through step S102, the container plug-in installed on the target application may store the code file and the resource file according to step S103, and configure access paths for calling the code file and the resource file, which is described in detail below.
S103, respectively configuring the code file and the resource file under the corresponding directory of the target application program, and respectively redirecting the access paths of the code file and the resource file so as to call the code file and the resource file in the target application program and run the target subprogram through the redirected access paths.
In the Android system, a target application program is generally installed under a data directory under a root directory, an APK compression package file of the target application program is stored under the root directory/data/app/target application program name directory, and a sub-program storage directory (here, the sub-program storage directory is used for storing APK compression package files of sub-programs downloaded by a user through the target application program) is created under the directory; and creates a subroutine code loading directory (here, a subroutine code loading directory for storing a code file of a subroutine downloaded by a user through the target application) corresponding to the target application under the root directory/data/data directory.
In a specific implementation, the code file and the resource file of the target sub-program determined in step S102 are respectively stored in different storage directories corresponding to the target sub-program in the target application program, and access paths of the code file and the resource file are respectively modified.
Specifically, the code file extracted from the installation package of the target sub-program may be stored in the target application program under the sub-program code loading directory named by the name of the target sub-program; the resource file can be stored in the installation package of the target subprogram, and the storage catalog of the resource file is determined according to the storage catalog of the installation package of the target subprogram; the resource file may be extracted from the installation package of the target sub-program, and stored in a storage directory of the sub-program of the target application program (i.e., in a dedicated directory of the target sub-program named by the name of the target sub-program in the sub-program storage directory of the target application program) corresponding to the target sub-program.
Here, the storage directory of the installation package of the target subroutine is: the storage catalogue corresponding to the target subprogram in the subprogram storage catalogue of the target application program, namely the target subprogram exclusive catalogue in the subprogram storage catalogue of the target application program, namely the root catalogue/data/app/target application program name/target subprogram name catalogue.
Here, since the game program is described in detail taking the target subprogram downloaded through the target application program as an example in the embodiment of the present disclosure, a specific embodiment in which the target game-specific catalog is used as the target subprogram-specific catalog will be described in detail below.
Specifically, the code file (i.e., the dynamic library file and the game engine code file corresponding to the ABI of the host APP) decompressed from the installation package of the target game in step S102 is stored under the sub-program code loading directory named by the target game name in the target application (i.e., under the root directory/data/data/target application name/target game name directory); the storage directory of the resource file determined by step S102 may be determined as follows, based on the storage directory of the APK compression package file of the target game determined in step S101 (i.e., root directory/data/app/target application name/target game name directory): root directory/data/app/target application name/target game name directory; the resource file of the target game determined in step S102 may be extracted from the APK compression packet file of the target game, and directly stored in the target game dedicated directory named by the target game name in the subroutine storage directory of the target application (i.e. under the root directory/data/app/target application name/target game name directory), where the directory structure of the specific storage code file and the resource file is shown in fig. 2.
In general, if a target game APP is downloaded and installed locally, when the target game APP is run, a system installation path of the target game APP is generally taken as a default access path, a system process searches a game engine code of the target game APP under a system installation directory, and starts a game engine of the target game APP, and the game engine of the target game APP directly searches and invokes a code file required by the target game in a folder under the system installation directory and a resource file required by the target game during running; however, the present disclosure does not install the target game APP, but stores the code file and the resource file in different storage directories corresponding to the target game in the target application program through the container plug-in installed on the target application program, so that a default path for searching and calling the code file and the resource file needs to be modified through the container plug-in installed on the target application program, and the specific modification is described as follows.
In a specific implementation, after the code file and the resource file are respectively stored under different storage directories corresponding to the target subprogram in the target application program, the searching path for searching the code file can be modified according to the storage directory of the code file (namely, the subprogram code loading directory named by the name of the target subprogram in the target application program, namely, the root directory/data/data/target application program name/target subprogram name directory), and the resource reading and writing path of the game engine can be modified according to the storage directory of the resource file (namely, the target subprogram exclusive directory named by the name of the target subprogram in the subprogram storage directory of the target application program, namely, the root directory/data/app/target application program name/target subprogram name directory).
Specifically, the container plug-in installed on the target application program may employ a preset path modification mechanism to add a subroutine code storage directory named by the target game name in the target application program to the forefront position of the search path of the code file, so as to configure the search path for searching the code file; and takes the storage path (namely, root directory/data/app/target application program name/target game name/resource file name) of the resource file under the target game exclusive directory named by the target game name in the subprogram storage directory of the target application program as the call address for calling the resource file.
The preset path modification mechanism may include rewrite (rewrite is the implementation process of a method allowing access to a parent class by a child, and neither a return value nor a shape parameter can be changed), a reflection mechanism (java reflection mechanism is in a running state, for any class, all attributes and methods of the whole class can be known, for any object, any method and attribute thereof can be called, and functions of dynamically acquiring information and dynamically calling a method of the object), and a hook function hook.
Specifically, the container plug-in installed in the host APP can acquire an instance object of the game engine through a reflection mechanism, and store a path function (i.e., getexternalfiles dir function) through an acquisition application file in an override, activity component activity, etc., based on a storage path of the game engine code: the root directory/data/data/target application program name/target game name/game engine code name, and the instance object is modified correspondingly, so that redirection of the system process to access the game engine code path is realized; and through an override, an acquisition application file storage path function (namely a getExternalFilesDir function) in the activity component activity, and the like, the storage path of the dynamic library file based on the target game is: reconfiguring a path of the game engine to access the dynamic library file of the target game item; and based on the storage path of the resource file of the target game: the root directory/data/app/target application program name/target game name directory/resource file name, and the path of the game engine for accessing the game resource is reconfigured, so that the redirection of the game engine to the game item code and the access path of the game resource is realized; here, the game item code may include a function for realizing various functions, for example, a function for realizing screen switching, character object control, and the like.
Here, since the code files capable of realizing the same function may be simultaneously included under the system directory (i.e., the root directory), under the target application program directory, and under the target game directory, when the target game is run in the target application program, if the code files that the game engine needs to call are the code files of the functions simultaneously included under the system directory, under the target application program directory, and under the target game directory, the game engine needs to search the code files realizing the functions under the target game directory first.
Specifically, the container plug-in installed on the target application program can modify the mechanism through a preset path, and the search catalog sequence of the code file of the target game searched by the game engine is as follows: the method comprises the steps of searching code files for realizing the function under a system catalog (namely a root catalog), searching code files for realizing the function under a target application catalog, searching the code files for realizing the function under the target game catalog, modifying to search the code files for realizing the function under the target game catalog, searching the code files for realizing the function under the system catalog, and searching the code files for realizing the function under the target application catalog.
In a specific implementation, after the container plug-in installed on the target application program reconfigures the access paths of the code file and the resource file, the container plug-in can respond to a starting instruction for the target game, start the game engine in the target application program based on the accessed code of the game engine, and call other codes of the code file and the resource file through the game engine to run the target game.
Here, the starting instruction of the target game may be an instruction generated after the user performs the triggering operation on the target game according to the operation prompt information provided by the target application program display page (may be the operation prompt information such as the text prompt information such as "click page enter game").
Specifically, according to the starting instruction of the target game, a game engine code is searched under the root directory/data/data/target application program name/target game name directory, and the game engine is started in the target application program; after the game engine is started, other codes required in the running process of the target game are searched and called under the root directory/data/data/target application program name/target game name directory through the game engine, and resources required in the running process of the target game are searched and called under the root directory/data/app/target application program name/target game name directory through the game engine, so that the target game is run in the target application program.
Referring to fig. 3, a detailed flowchart of an application running in an application process provided in the present disclosure is specifically described below:
in a specific embodiment, in the running process of a target application program, a user clicks related introduction information and a download link of a target game displayed on a target application program page, after the user clicks the download link, the target application program obtains running environment information of the running target game contained in the download link, and according to an API of the target game contained in the running environment information, a container plug-in matched with the target game is obtained in a plug-in server, the container plug-in is downloaded, and the container plug-in is installed on the target application program; downloading an installation package of the target game through the container plug-in, and storing the installation package into a subprogram storage catalog of the target application program, wherein the method comprises the steps of: under the root directory/data/app/target application program name/target game name directory, after downloading the installation package of the target game, the container plug-in decompresses and saves the dynamic library file corresponding to the ABI of the target application program in the installation package and the code file of the game engine to the target application program under the sub program code loading directory named by the target game name: the root directory/data/data/target application program name/target game name directory; taking files in the installation package except the dynamic library file corresponding to the ABI of the target application program and the code file of the game engine as resource files (namely game resource files); and determining that the resource file is stored under the target game exclusive directory under the subroutine storage directory in the target application program, namely under the root directory/data/app/target application program name/target game name directory (the resource file can be extracted from the installation package of the target game and stored under the root directory/data/app/target application program name/target game name directory).
After storing the code files (namely the dynamic library file and the code file of the game engine) and the resource files under different storage targets corresponding to the target game in the target application program, the calling path of the dynamic library file can be modified by methods such as rewriting, reflection, hook function and the like: root directory/data/data/target application name/target game name/dynamic library file name, and modifying the access path of the code file of the game engine to: root directory/data/data/target application name/target game name/game engine code file name; modifying the call path of the resource as follows: root directory/data/app/target application name/resource file name (where the resource file name is determined according to the resource file name to be called); and the method can enable the game engine to search the search catalog sequence of the code files of the functions required by running the target game by the methods of rewriting, reflecting, hooking functions and the like, and comprises the following steps: the method comprises the steps of searching code files for realizing the function under a system catalog (namely a root catalog), searching code files for realizing the function under a target application catalog, searching the code files for realizing the function under the target game catalog, modifying to search the code files for realizing the function under the target game catalog, searching the code files for realizing the function under the system catalog, and searching the code files for realizing the function under the target application catalog.
After reconfiguring the call paths of the code files and resource files, the system process may rely on the access paths of the code files of the game engine: the root directory/data/data/target application name/target game name/game engine code file name, accessing the code of the game engine, thereby starting the game engine in the target application; after the game engine is started, the game engine searches and calls codes required in the running process of the target game under the root directory/data/data/target application program name/target game name directory according to the call path of the dynamic library file of the target game, and searches and calls resources required in the running process of the target game under the root directory/data/app/target application program name/target game name directory according to the call path of the resource file of the target game, so that the target game is run in the target application program.
In the embodiment of the disclosure, an installation package of a target subprogram is downloaded through the target application program, a code file and a resource file of the target subprogram are obtained based on the installation package, the code file and the resource file are respectively configured under a corresponding directory of the target application program, and access paths of the code file and the resource file are respectively redirected, so that the code file and the resource file can be called in the target application program through the redirected access paths, and the target subprogram is operated; in the embodiment of the disclosure, the target subprogram can be directly stored and access path redirected through the target application program without local installation of the subprogram installation package, so that the target subprogram can be directly operated in the target application program, the installation process is omitted, and the operation process of the target subprogram is simple and convenient.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiments of the present disclosure further provide an apparatus for running an application corresponding to the method for running an application, and since the principle of solving the problem by the apparatus in the embodiments of the present disclosure is similar to that of the method for running an application in the embodiments of the present disclosure, implementation of the apparatus may refer to implementation of the method, and repeated descriptions are omitted.
Example two
Referring to fig. 4, a schematic structural diagram of an apparatus 400 for running an application according to an embodiment of the disclosure is provided, where the apparatus includes: a download module 401, an acquisition module 402, and a configuration module 403; the downloading module 401 is configured to download, by using the target application, an installation package of the target sub-program.
And an acquisition module 402, configured to acquire a code file and a resource file of the target subroutine based on the installation package.
And the configuration module 403 is configured to configure the code file and the resource file under the corresponding directories of the target application program respectively, and redirect the access paths of the code file and the resource file respectively, so that the code file and the resource file are called in the target application program through the redirected access paths, and the target subroutine is operated.
In a possible implementation manner, the obtaining module 402 is specifically configured to decompress, based on a type of an application binary interface ABI corresponding to the target application, the code file corresponding to the type of the ABI from the installation package; and taking the files except the code file in the installation package as the resource file.
In one possible implementation, the target subroutine is a game program.
In a possible implementation manner, the configuration module 403 is specifically configured to store the code file and the resource file in different storage directories corresponding to the target subroutine in the target application program, and modify access paths of the code file and the resource file, respectively.
In a possible implementation manner, the configuration module 403 is further specifically configured to add the storage directory of the code file in the target application program to the forefront position of the search path of the code file by adopting a preset path modification mechanism.
In one possible implementation, the apparatus further includes a response module, configured to respond to a start instruction for the target subroutine, start the game engine in the target application program based on the accessed code of the game engine, and call other codes of the code file and the resource file through the game engine to run the target subroutine.
In a possible implementation manner, the device further comprises a plug-in acquisition module, which is specifically configured to acquire the running environment information of the target sub-program on the target application program; based on the running environment information, downloading a container plug-in corresponding to the target subprogram and installing the container plug-in on the target application program; the container plug-in is used for executing the process of downloading the installation package of the target subprogram, acquiring the code file and the resource file and redirecting the access path.
In the embodiment of the disclosure, an installation package of a target subprogram is downloaded through the target application program, a code file and a resource file of the target subprogram are obtained based on the installation package, the code file and the resource file are respectively configured under a corresponding directory of the target application program, and access paths of the code file and the resource file are respectively redirected, so that the code file and the resource file can be called in the target application program through the redirected access paths, and the target subprogram is operated; in the embodiment of the disclosure, the target subprogram can be directly stored and access path redirected through the target application program without local installation of the subprogram installation package, so that the target subprogram can be directly operated in the target application program, the installation process is omitted, and the operation process of the target subprogram is simple and convenient.
The process flow of each module in the apparatus and the interaction flow between the modules may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
Based on the same technical conception, the embodiment of the application also provides computer equipment. Referring to fig. 5, a schematic structural diagram of a computer device 500 according to an embodiment of the present application includes a processor 501, a memory 502, and a bus 503. The memory 502 is configured to store execution instructions, including a memory 5021 and an external memory 5022; the memory 5021 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 501 and data exchanged with an external memory 5022 such as a hard disk, the processor 501 exchanges data with the external memory 5022 through the memory 5021, and when the computer device 500 is running, the processor 501 and the memory 502 communicate through the bus 503, so that the processor 501 executes the following instructions:
downloading an installation package of the target subprogram through the target application program; acquiring a code file and a resource file of the target subprogram based on the installation package; and respectively configuring the code file and the resource file under the corresponding directory of the target application program, and respectively redirecting the access paths of the code file and the resource file so as to call the code file and the resource file in the target application program and run the target subprogram through the redirected access paths.
The specific processing flow of the processor 501 may refer to the description of the above method embodiments, and will not be repeated here.
The disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of application execution described in the method embodiments above. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The computer program product of the method for operating an application provided in the embodiment of the present disclosure includes a computer readable storage medium storing program code, where the program code includes instructions for executing the steps of the method for operating an application described in the above method embodiment, and specifically, reference may be made to the above method embodiment, which is not repeated herein.
The disclosed embodiments also provide a computer program which, when executed by a processor, implements any of the methods of the previous embodiments. The computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present disclosure, and are not intended to limit the scope of the disclosure, but the present disclosure is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, it is not limited to the disclosure: any person skilled in the art, within the technical scope of the disclosure of the present disclosure, may modify or easily conceive changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features thereof; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the disclosure, and are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.