+

CN107168719A - Application program running method and device, terminal and computer readable storage medium - Google Patents

Application program running method and device, terminal and computer readable storage medium Download PDF

Info

Publication number
CN107168719A
CN107168719A CN201710407242.6A CN201710407242A CN107168719A CN 107168719 A CN107168719 A CN 107168719A CN 201710407242 A CN201710407242 A CN 201710407242A CN 107168719 A CN107168719 A CN 107168719A
Authority
CN
China
Prior art keywords
resource file
package
resource
installation package
file
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
CN201710407242.6A
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.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology 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 Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN201710407242.6A priority Critical patent/CN107168719A/en
Publication of CN107168719A publication Critical patent/CN107168719A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

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

Abstract

本发明公开了一种应用程序运行方法。该方法包括:在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;其中,所述资源文件包为与所述应用程序安装包关联的安装包;所述应用程序安装包和所述资源文件包中对应资源文件的标识相同;若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。相应地,本发明还公开了一种应用程序运行装置、终端和计算机可读存储介质。本发明实施例实现了修改资源文件方便、节省编译和发布的资源的效果。

The invention discloses an application program running method. The method includes: calling the resource file from the resource file package according to the identifier of the resource file when a resource file call request is generated during the code running process in the application installation package; The installation package associated with the package; the identification of the application installation package and the corresponding resource file in the resource file package are the same; if calling the resource file from the resource file package fails, then according to the identification of the resource file from the The application installation package calls resource files. Correspondingly, the present invention also discloses an application program running device, a terminal and a computer-readable storage medium. The embodiment of the present invention realizes the effects of conveniently modifying resource files and saving resources for compiling and publishing.

Description

应用程序运行方法、装置、终端及计算机可读存储介质Application program running method, device, terminal and computer-readable storage medium

技术领域technical field

本发明实施例涉及终端应用技术领域,尤其涉及一种应用程序运行方法、装置、终端及计算机可读存储介质。Embodiments of the present invention relate to the technical field of terminal applications, and in particular, to an application program running method, device, terminal, and computer-readable storage medium.

背景技术Background technique

终端系统的应用程序是以安装包的形式存放于终端中,例如Android系统以apk(AndroidPackage,安卓安装包)的形式存放,IOS系统以ipa(iPhoneApplication,Apple程序应用文件)的形式存放。The application program of the terminal system is stored in the terminal in the form of an installation package, for example, the Android system is stored in the form of apk (Android Package, Android installation package), and the IOS system is stored in the form of ipa (iPhoneApplication, Apple program application file).

以Android系统为例,一个常规的apk,其源码结构包括代码、资源文件和入口文件(AndroidManifest.xml文件),其中,入口文件配置了程序运行所必要的组件。将上述代码和资源文件通过编译命令或IDE工具可编译出apk安装包。当应用程序运行时,会执行代码,在代码执行过程中需要调用资源文件时,一般是根据资源文件的标识从apk中调用资源文件。Taking the Android system as an example, the source code structure of a conventional apk includes code, resource files and an entry file (AndroidManifest.xml file), wherein the entry file configures the components necessary for the program to run. The apk installation package can be compiled by compiling the above code and resource files through the compilation command or IDE tool. When the application program is running, the code will be executed. When the resource file needs to be called during the code execution process, the resource file is generally called from the apk according to the identifier of the resource file.

发明人在实施本发明的过程中,发现现有技术方案具有以下缺陷:对于已发布的安装包,如果想要更改一小部分的资源文件,比如更改字符串的显示,更改其中一些图片等等,需要在更新资源文件后重新编译一个apk安装包,再进行覆盖安装,耗费大量的资源。In the process of implementing the present invention, the inventor found that the existing technical solutions have the following defects: for the published installation package, if you want to change a small part of resource files, such as changing the display of character strings, changing some of the pictures, etc. , it is necessary to recompile an apk installation package after updating the resource file, and then overwrite the installation, which consumes a lot of resources.

发明内容Contents of the invention

本发明提供一种应用程序运行方法、装置、终端及计算机可读存储介质,以实现在面对更改应用程序的资源文件时,不需要重新编译应用程序安装包,减小资源的耗费。The present invention provides an application program running method, device, terminal and computer-readable storage medium, so as to realize that when the resource file of the application program is changed, the application program installation package does not need to be recompiled, and resource consumption is reduced.

第一方面,本发明实施例提供了一种应用程序运行方法,包括:In a first aspect, an embodiment of the present invention provides a method for running an application program, including:

在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;其中,所述资源文件包为与所述应用程序安装包关联的安装包;所述应用程序安装包和所述资源文件包中对应资源文件的标识相同;When a resource file call request is generated during the code running in the application installation package, the resource file is called from the resource file package according to the identifier of the resource file; wherein, the resource file package is an installation associated with the application installation package package; the identification of the corresponding resource file in the application installation package and the resource file package is the same;

若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。If calling the resource file from the resource file package fails, call the resource file from the application installation package according to the identifier of the resource file.

进一步地,所述资源文件包中的入口文件包含有声明本资源文件包与所述应用程序安装包关联的标签;Further, the entry file in the resource file package includes a label declaring that the resource file package is associated with the application installation package;

所述在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件,具体包括:When the resource file call request is generated during the code running process in the application installation package, the resource file is called from the resource file package according to the identifier of the resource file, specifically including:

在各安装包的入口文件中检测是否存在声明标签;Detect whether there is a declaration tag in the entry file of each installation package;

根据所述资源文件的标识从包含有该标签的安装包中调用资源文件。The resource file is called from the installation package containing the tag according to the identifier of the resource file.

进一步地,所述若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件,具体包括:Further, if calling the resource file from the resource file package fails, calling the resource file from the application installation package according to the identifier of the resource file specifically includes:

若读取不到所述资源文件包,则根据资源文件的标识从所述应用程序安装包调用资源文件;If the resource file package cannot be read, then call the resource file from the application installation package according to the identifier of the resource file;

若读取到所述资源文件包,且根据所述资源文件的标识从所述资源文件包中调用不到所述资源文件,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。If the resource file package is read, and the resource file cannot be called from the resource file package according to the identifier of the resource file, then call the resource from the application installation package according to the identifier of the resource file document.

进一步地,所述应用程序运行方法还包括:Further, the application running method also includes:

在接收到恢复使用所述应用程序安装包中的资源文件的指令时,删除所述资源文件包。When receiving an instruction to resume using the resource files in the application installation package, delete the resource file package.

进一步地,所述资源文件为图片文件或字符串文件。Further, the resource file is a picture file or a character string file.

第二方面,本发明实施例还提供了一种应用程序运行装置,该应用程序运行装置包括:In a second aspect, an embodiment of the present invention further provides an application program running device, the application program running device comprising:

第一调用模块,用于在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;其中,所述资源文件包为与所述应用程序安装包关联的安装包;所述应用程序安装和所述资源文件包中对应的资源文件的标识相同;The first calling module is used to call the resource file from the resource file package according to the identifier of the resource file when a resource file calling request is generated during the code running process in the application installation package; wherein, the resource file package is the same as the resource file package An installation package associated with the application installation package; the identification of the application installation and the corresponding resource file in the resource file package are the same;

第二调用模块,用于若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。The second calling module is configured to call the resource file from the application installation package according to the identifier of the resource file if calling the resource file from the resource file package fails.

进一步地,所述第二调用模块包括:Further, the second calling module includes:

第一原始调用单元,用于若读取不到所述资源文件包,则根据资源文件的标识从所述应用程序安装包调用资源文件;The first original calling unit is used to call the resource file from the application installation package according to the identifier of the resource file if the resource file package cannot be read;

第二原始调用单元,用于若读取到所述资源文件包,且根据所述资源文件的标识从所述资源文件包中调用不到所述资源文件,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。The second original calling unit is configured to: if the resource file package is read, and the resource file cannot be called from the resource file package according to the identifier of the resource file, then from the resource file package according to the identifier of the resource file The application installation package calls resource files.

进一步地,所述应用程序运行装置还包括:Further, the application running device also includes:

恢复模块,用于在接收到恢复使用所述应用程序安装包中的资源文件的指令时,删除所述资源文件包。The restoration module is configured to delete the resource file package when receiving an instruction to resume use of the resource file in the application installation package.

第三方面,本发明实施例还提供了一种终端,所述终端包括:In a third aspect, an embodiment of the present invention further provides a terminal, where the terminal includes:

一个或多个处理器;one or more processors;

存储装置,用于存储一个或多个程序;storage means for storing one or more programs;

当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现以上任一所述的应用程序运行方法。When the one or more programs are executed by the one or more processors, the one or more processors are made to implement any one of the application program running methods described above.

第四方面,本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现以上任一所述的应用程序运行方法。In a fourth aspect, the embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, any one of the application program running methods described above is implemented.

本发明实施例通过将调用资源文件的方法调整为先从资源文件包中调用资源文件,若从资源文件包中调用失败再从应用程序安装包中调用资源文件,使得可以通过增加资源文件包的方式来替代应用程序安装包中资源文件的使用,在需要更新资源文件时无需重新编译整个应用程序安装包,解决现有技术方案需要重新编译应用程序安装包造成资源耗费大的问题,实现修改资源文件方便、节省编译和发布的资源的效果。In the embodiment of the present invention, by adjusting the method of calling resource files to call resource files from the resource file package first, and then call the resource files from the application installation package if the call fails from the resource file package, it is possible to increase the resource file package. This method replaces the use of resource files in the application installation package. When the resource file needs to be updated, the entire application installation package does not need to be recompiled, which solves the problem of high resource consumption caused by the need to recompile the application installation package in the existing technical solutions, and realizes the modification of resources. Documentation convenience, resource-saving effects for compilation and distribution.

附图说明Description of drawings

图1是本发明实施例一中的应用程序运行方法的流程图;FIG. 1 is a flowchart of an application program running method in Embodiment 1 of the present invention;

图2是本发明实施例一中的应用程序运行方法的原理图;FIG. 2 is a schematic diagram of an application program running method in Embodiment 1 of the present invention;

图3是本发明实施例二中的应用程序运行方法的流程图;FIG. 3 is a flowchart of an application program running method in Embodiment 2 of the present invention;

图4是本发明实施例三中的应用程序运行装置的结构示意图;FIG. 4 is a schematic structural diagram of an application running device in Embodiment 3 of the present invention;

图5是本发明实施例四提供的一种终端的结构示意图。FIG. 5 is a schematic structural diagram of a terminal provided by Embodiment 4 of the present invention.

具体实施方式detailed description

下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention. In addition, it should be noted that, for the convenience of description, only some structures related to the present invention are shown in the drawings but not all structures.

实施例一Embodiment one

图1为本发明实施例一提供的应用程序运行方法的流程图,本实施例可适用于终端操作系统中应用程序运行过程中对资源文件的调取使用,例如在Android系统该方法可以通过更改Android frameworks源码Runtime Resource Overlay机制来实现,具体包括如下步骤:Fig. 1 is a flow chart of the application program running method provided by Embodiment 1 of the present invention. This embodiment is applicable to the calling and use of resource files during the application program running process in the terminal operating system. For example, in the Android system, this method can be modified The Android frameworks source code Runtime Resource Overlay mechanism is implemented, including the following steps:

步骤110、在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;Step 110, when a resource file call request is generated during the code running in the application installation package, call the resource file from the resource file package according to the identifier of the resource file;

其中,所述资源文件包为与所述应用程序安装包关联的安装包;所述应用程序安装包和所述资源文件包中对应资源文件的标识相同;具体地,所述应用程序安装包包含该应用程序的代码和一个或多个原始资源文件;所述资源文件包包含一个或多个与所述原始资源文件全部或部分对应的资源文件,具体实施时,可以是做了更新修改的资源文件;此外,以Android系统为例,在具体实施时,各安装包除包含代码和/或原始资源代码外,还须包含Android应用程序的入口文件AndroidManifest.xml,该入口文件配置了应用程序运行所必要的组件;资源文件的标识包括资源文件的身份信息(ID)以及配置信息(cfg),根据资源文件的标识可在安装包中找到对应的资源文件;;Wherein, the resource file package is an installation package associated with the application installation package; the identification of the application installation package and the corresponding resource file in the resource file package are the same; specifically, the application installation package contains The code of the application program and one or more original resource files; the resource file package contains one or more resource files corresponding to all or part of the original resource files, and may be updated and modified resources during specific implementation In addition, taking the Android system as an example, in the actual implementation, each installation package must contain the Android application entry file AndroidManifest.xml in addition to the code and/or original resource code. Necessary components; the identification of the resource file includes the identity information (ID) and configuration information (cfg) of the resource file, and the corresponding resource file can be found in the installation package according to the identification of the resource file;

步骤120、若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。Step 120, if calling the resource file from the resource file package fails, call the resource file from the application installation package according to the identifier of the resource file.

图2为本实施例应用程序运行方法的原理图,如图所示,该应用程序运行方法的工作原理为:在应用程序(app)安装包中的代码运行过程中产生调用资源文件23的请求时,根据资源文件的标识(ID及cfg)先从包含有更新的资源文件的资源文件包22(overlay.apk)中调用,若调用失败,则到应用程序安装包21(app.apk)中调用,成功调用到资源文件返回至应用程序(app)显示。Fig. 2 is the schematic diagram of the application program operation method of this embodiment, as shown in the figure, the working principle of the application program operation method is: a request for calling the resource file 23 is generated during the code operation process in the application program (app) installation package , according to the identification (ID and cfg) of the resource file, it is first called from the resource file package 22 (overlay.apk) containing the updated resource file, and if the call fails, it is called in the application installation package 21 (app.apk) Call, successfully call the resource file and return to the application program (app) for display.

本实施例的技术方案,通过将调用资源文件的方法调整为先从资源文件包中调用资源文件,若从资源文件包中调用失败再从应用程序安装包中调用资源文件,使得可以通过增加资源文件包的方式来替代应用程序安装包中的资源文件的使用,在需要更新资源文件时无需重新编译整个应用程序安装包,解决现有技术方案需要重新编译应用程序安装包造成资源耗费大的问题,实现修改资源文件方便、节省编译和发布的资源的效果。并且,资源文件的修改可以和代码的修改分开,不相互影响,提高了应用程序的可维护性,也方便根据不同的需求对应用的资源文件进行配置。In the technical solution of this embodiment, by adjusting the method of calling resource files to first call resource files from resource file packages, if calling resource files from resource file packages fails, then call resource files from application installation packages, so that resources can be added The use of resource files in the application installation package is replaced by a file package, and the entire application installation package does not need to be recompiled when the resource file needs to be updated, which solves the problem of large resource consumption caused by the need to recompile the application installation package in the existing technical solutions , to achieve the effect of conveniently modifying resource files and saving resources for compilation and release. Moreover, the modification of the resource file can be separated from the modification of the code without affecting each other, which improves the maintainability of the application program and facilitates the configuration of the resource file of the application according to different requirements.

在上述技术方案的基础上,优选地,应用程序运行方法的步骤120具体包括:On the basis of the above technical solution, preferably, step 120 of the application program running method specifically includes:

若读取不到所述资源文件包,则根据资源文件的标识从所述应用程序安装包调用资源文件;If the resource file package cannot be read, then call the resource file from the application installation package according to the identifier of the resource file;

若读取到所述资源文件包,且根据所述资源文件的标识从所述资源文件包中调用不到所述资源文件,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。If the resource file package is read, and the resource file cannot be called from the resource file package according to the identifier of the resource file, then call the resource from the application installation package according to the identifier of the resource file document.

该优选实施方式设置了调用资源文件失败可有两种情况:一、资源文件包不存在;二、资源文件包中不存在应用程序要调用的资源文件。对于该优选实施方式,资源文件包和应用程序安装包中的资源文件可以只是部分对应替代,而无需全部对应替代,使得本领域技术人员在通过增加资源文件包的方式来修改资源文件时,可以在资源文件包中最小化资源文件包的容量,即资源文件包中的资源文件仅包括更新的资源文件,从而进一步减少安装包的编译和发布的资源耗费,也减少文件在终端存储介质中的占用量。In this preferred implementation mode, there are two situations in which the failure to call the resource file is set: 1. The resource file package does not exist; 2. The resource file to be called by the application program does not exist in the resource file package. For this preferred implementation, the resource files in the resource file package and the application installation package can only be partially replaced, but not all correspondingly replaced, so that when those skilled in the art modify the resource file by adding a resource file package, they can Minimize the capacity of the resource file package in the resource file package, that is, the resource files in the resource file package only include updated resource files, thereby further reducing the resource consumption of compiling and publishing the installation package, and also reducing the file size in the terminal storage medium occupancy.

在上述技术方案的基础上,作为查找资源文件包的优选方式,所述资源文件包中的入口文件包含有声明本资源文件包与所述应用程序安装包关联的标签;步骤110、在应用程序调用资源文件时,根据资源文件的标识从资源文件包中调用资源文件,具体包括:On the basis of the above technical solution, as an optimal way to search for the resource file package, the entry file in the resource file package contains a label declaring that the resource file package is associated with the application installation package; step 110, in the application program When calling a resource file, call the resource file from the resource file package according to the identifier of the resource file, including:

在各安装包的入口文件中检测是否存在声明标签;Detect whether there is a declaration tag in the entry file of each installation package;

根据所述资源文件的标识从包含有该标签的安装包中调用资源文件。The resource file is called from the installation package containing the tag according to the identifier of the resource file.

具体地,在Android系统中,实施上述优选实施方式可通过在资源文件包的入口文件AndroidManifest.xml中增加如下标签以实现与应用程序安装包区分:Specifically, in the Android system, the implementation of the above preferred implementation can be achieved by adding the following tags in the entry file AndroidManifest.xml of the resource file package to distinguish it from the application installation package:

其中,Package是资源文件包的包名,上述标签指定了targetPackage的值为应用程序安装包的包名,即声明了本安装包与应用程序安装包的关联关系。通过标签的设置区分了资源文件包和应用程序安装包,使得资源文件的管理方法能完善执行。Wherein, Package is the package name of the resource file package, and the above-mentioned tag specifies that the value of targetPackage is the package name of the application installation package, which declares the relationship between the installation package and the application installation package. The resource file package and the application program installation package are distinguished through the setting of the label, so that the management method of the resource file can be perfectly executed.

综上,本实施例的技术方案,解决现有技术方案需要重新编译应用程序安装包造成资源耗费大的问题,实现修改资源文件方便、节省编译和发布的资源的效果。To sum up, the technical solution of this embodiment solves the problem of high resource consumption caused by the need to recompile the application installation package in the prior technical solution, and achieves the effect of conveniently modifying resource files and saving resources for compilation and release.

实施例二Embodiment two

图3为本发明实施例二提供的应用程序运行方法的流程图,本实施例包括上述实施例一的全部特征,并且增加了恢复使用原始资源文件的步骤,同样可适用于终端操作系统中应用程序运行过程中对资源文件的调取使用,例如在Android系统该方法可以通过更改Android frameworks源码Runtime Resource Overlay机制来实现,具体包括如下步骤:Fig. 3 is a flow chart of the application program running method provided by Embodiment 2 of the present invention. This embodiment includes all the features of Embodiment 1 above, and adds a step of restoring and using the original resource file, which is also applicable to applications in terminal operating systems. The calling and use of resource files during the running of the program, for example, in the Android system, this method can be realized by changing the Android frameworks source code Runtime Resource Overlay mechanism, which specifically includes the following steps:

步骤310、在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;其中,所述资源文件包为与所述应用程序安装包关联的安装包,所述应用程序安装包和所述资源文件包中对应资源文件的标识相同;Step 310: When a resource file call request is generated during the code running in the application installation package, call the resource file from the resource file package according to the identifier of the resource file; wherein, the resource file package is the same as the application installation package An associated installation package, wherein the application installation package has the same identifier as the corresponding resource file in the resource file package;

步骤320、若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件;Step 320, if calling the resource file from the resource file package fails, call the resource file from the application installation package according to the identifier of the resource file;

步骤330、在接收到恢复使用所述应用程序安装包中的资源文件的指令时,删除所述资源文件包。Step 330, when receiving an instruction to resume using the resource files in the application installation package, delete the resource file package.

本实施例的技术方案,通过增加资源文件包的方式来替代原始资源文件,无需重新编译整个应用程序安装包,并且,在接收到恢复使用原始文件的指令时,删除所述资源文件包;由于应用程序安装包保留有原始资源文件,因此删除资源文件包即可恢复使用原始资源文件,解决了现有技术中在应用程序安装包中更新了资源文件后无法恢复的问题,实现了恢复简单的效果。In the technical solution of this embodiment, the original resource file is replaced by adding a resource file package, without recompiling the entire application installation package, and when receiving an instruction to restore the use of the original file, the resource file package is deleted; because The application installation package retains the original resource files, so the original resource files can be restored by deleting the resource file package, which solves the problem in the prior art that the resource files cannot be restored after updating the application installation package, and realizes simple restoration Effect.

在上述技术方案的基础上,该应用程序运行方法还可以包括:On the basis of the above technical solution, the application running method may also include:

从服务器接收第二资源文件包;其中,所述第二资源文件包和所述应用程序安装包中对应的标识相同;Receive a second resource file package from the server; wherein, the second resource file package is the same as the corresponding identifier in the application installation package;

删除原有的资源文件包,并以所述第二资源文件包作为当前的资源文件包。The original resource file package is deleted, and the second resource file package is used as the current resource file package.

上述改进方案是对资源文件二次修改进行了适应性改进,卸载原有的资源文件安装第二资源文件包可获得最新的资源文件。显然,本实施例将资源文件的修改与代码进行隔离,在二次修改时重新编译和发布资源文件安装包,所损耗的资源远小于整个应用程序安装包进行重新编译和发布所损耗的资源,且通过减少重新编译和发布的次数,可降低由于可能存在不当操作或是编译环境变更所带来的风险。当然,本领域技术人员还可以继续通过更改Android frameworks源码Runtime Resource Overlay机制来调整调用资源文件的方法,使得第二资源文件包与原有的资源文件包共存,资源文件的调用顺序调整为先从第二资源文件包调用,再从原有的资源文件包调用,即按照下载时间调整资源文件包调用的优先级;当从所有资源文件包调用都失败时,再从应用程序安装包进行调用。这些方案都不脱离本发明的保护范围。The above improvement plan is an adaptive improvement to the secondary modification of the resource file. Uninstall the original resource file and install the second resource file package to obtain the latest resource file. Obviously, this embodiment isolates the modification of the resource file from the code, recompiles and releases the resource file installation package during the second modification, and the resources consumed are far less than the resources consumed by recompiling and releasing the entire application installation package. And by reducing the number of times of recompilation and release, the risks caused by possible improper operations or changes in the compilation environment can be reduced. Of course, those skilled in the art can continue to adjust the method of calling resource files by changing the Android frameworks source code Runtime Resource Overlay mechanism, so that the second resource file package coexists with the original resource file package, and the calling order of the resource files is adjusted to start with The second resource file package is called, and then called from the original resource file package, that is, the priority of the resource file package call is adjusted according to the download time; when all resource file packages fail to be called, the application installation package is called again. These solutions all do not depart from the scope of protection of the present invention.

综上,本实施例的技术方案,在解决现有技术方案需要重新编译应用程序安装包造成资源耗费大的问题的基础上,还解决了现有技术方案中在应用程序安装包中更新了资源文件后无法恢复的问题,实现修改资源文件方便、节省编译和发布的资源、恢复简单的效果。To sum up, the technical solution of this embodiment, on the basis of solving the problem of high resource consumption caused by the need to recompile the application installation package in the existing technical solution, also solves the problem of updating resources in the application installation package in the existing technical solution. The problem that the file cannot be restored after the file can be modified is convenient to modify the resource file, save compilation and release resources, and restore the effect of simplicity.

实施例三Embodiment Three

图4为本发明实施例二提供的应用程序运行装置的结构示意图;该装置包括:FIG. 4 is a schematic structural diagram of an application program running device provided in Embodiment 2 of the present invention; the device includes:

第一调用模块,用于在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;其中,所述资源文件包为与所述应用程序安装包关联的安装包;所述应用程序安装包和所述资源文件包中对应资源文件的标识相同;The first calling module is used to call the resource file from the resource file package according to the identifier of the resource file when a resource file calling request is generated during the code running process in the application installation package; wherein, the resource file package is the same as the resource file package An installation package associated with the application installation package; the identification of the corresponding resource file in the application installation package and the resource file package is the same;

第二调用模块,用于若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。The second calling module is configured to call the resource file from the application installation package according to the identifier of the resource file if calling the resource file from the resource file package fails.

进一步地,所述资源文件包中的入口文件包含有声明本资源文件包与所述应用程序安装包关联的标签;Further, the entry file in the resource file package includes a label declaring that the resource file package is associated with the application installation package;

所述第一调用模块包括:The first calling module includes:

检测单元,用于在各安装包的入口文件中检测是否存在声明标签;A detection unit is used to detect whether there is a declaration tag in the entry file of each installation package;

执行单元,用于根据所述资源文件的标识从包含有该标签的安装包中调用资源文件。The execution unit is used to call the resource file from the installation package containing the tag according to the identifier of the resource file.

进一步地,所述第二调用模块包括:Further, the second calling module includes:

第一原始调用单元,用于若读取不到所述资源文件包,则根据资源文件的标识从所述应用程序安装包调用资源文件;The first original calling unit is used to call the resource file from the application installation package according to the identifier of the resource file if the resource file package cannot be read;

第二原始调用单元,用于若读取到所述资源文件包,且根据所述资源文件的标识从所述资源文件包中调用不到所述资源文件,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。The second original calling unit is configured to: if the resource file package is read, and the resource file cannot be called from the resource file package according to the identifier of the resource file, then from the resource file package according to the identifier of the resource file The application installation package calls resource files.

进一步地,所述应用程序运行装置还包括:Further, the application running device also includes:

恢复模块430,用于在接收到恢复使用所述应用程序安装包中的资源文件的指令时,删除所述资源文件包。The restoration module 430 is configured to delete the resource file package when receiving an instruction to resume using the resource file in the application installation package.

本发明实施例所提供的应用程序运行装置可执行本发明任意实施例所提供的应用程序运行方法,具备执行方法相应的功能模块和有益效果。The application program running device provided by the embodiment of the present invention can execute the application program running method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.

实施例四Embodiment four

图5为本发明实施例四提供的一种终端的结构示意图,如图5所示,该终端包括处理器510、存储器520、输入装置530和输出装置540;终端中处理器510的数量可以是一个或多个,图5中以一个处理器510为例;终端中的处理器510、存储器520、输入装置530和输出装置540可以通过总线或其他方式连接,图5中以通过总线连接为例。FIG. 5 is a schematic structural diagram of a terminal provided in Embodiment 4 of the present invention. As shown in FIG. 5, the terminal includes a processor 510, a memory 520, an input device 530, and an output device 540; the number of processors 510 in the terminal may be One or more, one processor 510 is taken as an example in FIG. 5; the processor 510, memory 520, input device 530, and output device 540 in the terminal can be connected through a bus or in other ways. In FIG. 5, a bus connection is taken as an example .

存储器520作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序以及模块,如本发明实施例中的应用程序运行方法对应的程序指令/模块(例如,应用程序运行装置中的第一调用模块310、第二调用模块320和恢复模块330)。处理器510通过运行存储在存储器520中的软件程序、指令以及模块,从而执行终端的各种功能应用以及数据处理,即实现上述的应用程序运行方法。The memory 520, as a computer-readable storage medium, can be used to store software programs, computer-executable programs and modules, such as program instructions/modules corresponding to the application program running method in the embodiment of the present invention (for example, the application program running device in the The first calling module 310, the second calling module 320 and the restoring module 330). The processor 510 executes various functional applications and data processing of the terminal by running software programs, instructions and modules stored in the memory 520 , that is, implements the above-mentioned application program running method.

作为其中一种实施方式,该终端为安卓智能电视。As one of the implementation manners, the terminal is an Android smart TV.

存储器520可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端的使用所创建的数据等。此外,存储器520可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器520可进一步包括相对于处理器510远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application program required by at least one function; the data storage area may store data created according to the use of the terminal, and the like. In addition, the memory 520 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage devices. In some examples, the memory 520 may further include a memory that is remotely located relative to the processor 510, and these remote memories may be connected to the terminal through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

输入装置530可用于接收输入的数字或字符信息,以及产生与终端的用户设置以及功能控制有关的键信号输入。输出装置540可包括显示屏等显示设备。The input device 530 can be used to receive input numbers or character information, and generate key signal input related to user settings and function control of the terminal. The output device 540 may include a display device such as a display screen.

实施例五Embodiment five

本发明实施例五还提供一种包含计算机可执行指令的存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所述的应用程序运行方法。Embodiment 5 of the present invention also provides a storage medium containing computer-executable instructions, on which a computer program is stored. When the program is executed by a processor, the method for running the application program described in the above-mentioned embodiments is implemented.

当然,本发明实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的方法操作,还可以执行本发明任意实施例所提供的应用程序运行方法中的相关操作.Certainly, the storage medium containing computer-executable instructions provided by the embodiments of the present invention, the computer-executable instructions are not limited to the above-mentioned method operations, and can also execute the application program running method provided by any embodiment of the present invention. related operations.

通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本发明可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(RandomAccess Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the above description about the implementation mode, those skilled in the art can clearly understand that the present invention can be realized by means of software and necessary general-purpose hardware, and of course it can also be realized by hardware, but in many cases the former is a better implementation mode . Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a floppy disk of a computer , read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or optical disc, etc., including several instructions to make a computer device (which can be a personal computer, A server, or a network device, etc.) executes the methods described in various embodiments of the present invention.

值得注意的是,上述应用程序运行装置的实施例中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。It is worth noting that, in the above-mentioned embodiment of the application program running device, the included units and modules are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, The specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present invention.

注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the present invention The scope is determined by the scope of the appended claims.

Claims (10)

1.一种应用程序运行方法,其特征在于,包括:1. A method for running an application program, comprising: 在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;其中,所述资源文件包为与所述应用程序安装包关联的安装包;所述应用程序安装包和所述资源文件包中对应资源文件的标识相同;When a resource file call request is generated during the code running in the application installation package, the resource file is called from the resource file package according to the identifier of the resource file; wherein, the resource file package is an installation associated with the application installation package package; the identification of the corresponding resource file in the application installation package and the resource file package is the same; 若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。If calling the resource file from the resource file package fails, call the resource file from the application installation package according to the identifier of the resource file. 2.如权利要求1所述的应用程序运行方法,其特征在于,所述资源文件包中的入口文件包含有声明本资源文件包与所述应用程序安装包关联的标签;2. The application program running method according to claim 1, wherein the entry file in the resource file package includes a label declaring that the resource file package is associated with the application installation package; 所述在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件,具体包括:When the resource file call request is generated during the code running process in the application installation package, the resource file is called from the resource file package according to the identifier of the resource file, specifically including: 在各安装包的入口文件中检测是否存在声明标签;Detect whether there is a declaration tag in the entry file of each installation package; 根据所述资源文件的标识从包含有该标签的安装包中调用资源文件。The resource file is called from the installation package containing the tag according to the identifier of the resource file. 3.如权利要求1所述的应用程序运行方法,其特征在于,所述若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件,具体包括:3. The application program running method according to claim 1, wherein if calling the resource file from the resource file package fails, calling the resource from the application installation package according to the identifier of the resource file files, including: 若读取不到所述资源文件包,则根据资源文件的标识从所述应用程序安装包调用资源文件;If the resource file package cannot be read, then call the resource file from the application installation package according to the identifier of the resource file; 若读取到所述资源文件包,且根据所述资源文件的标识从所述资源文件包中调用不到所述资源文件,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。If the resource file package is read, and the resource file cannot be called from the resource file package according to the identifier of the resource file, then call the resource from the application installation package according to the identifier of the resource file document. 4.如权利要求1至3任一项所述的应用程序运行方法,其特征在于,所述资源文件管理方法还包括:4. The application program running method according to any one of claims 1 to 3, wherein the resource file management method further comprises: 在接收到恢复使用所述应用程序安装包中的资源文件的指令时,删除所述资源文件包。When receiving an instruction to resume using the resource files in the application installation package, delete the resource file package. 5.如权利要求1所述的应用程序运行方法,其特征在于,所述资源文件为图片文件或字符串文件。5. The application program running method according to claim 1, wherein the resource file is a picture file or a character string file. 6.一种应用程序运行装置,其特征在于,包括:6. An application program running device, comprising: 第一调用模块,用于在应用程序安装包中的代码运行过程中产生资源文件调用请求时,根据资源文件的标识从资源文件包中调用资源文件;其中,所述资源文件包为与所述应用程序安装包关联的安装包;所述应用程序安装包和所述资源文件包中对应资源文件的标识相同;The first calling module is used to call the resource file from the resource file package according to the identifier of the resource file when a resource file calling request is generated during the code running process in the application installation package; wherein, the resource file package is the same as the resource file package An installation package associated with the application installation package; the identification of the corresponding resource file in the application installation package and the resource file package is the same; 第二调用模块,用于若从所述资源文件包中调用资源文件失败,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。The second calling module is configured to call the resource file from the application installation package according to the identifier of the resource file if calling the resource file from the resource file package fails. 7.如权利要求6所述的应用程序运行装置,其特征在于,所述第二调用模块包括:7. The application program running device according to claim 6, wherein the second calling module comprises: 第一原始调用单元,用于若读取不到所述资源文件包,则根据资源文件的标识从所述应用程序安装包调用资源文件;The first original calling unit is used to call the resource file from the application installation package according to the identifier of the resource file if the resource file package cannot be read; 第二原始调用单元,用于若读取到所述资源文件包,且根据所述资源文件的标识从所述资源文件包中调用不到所述资源文件,则根据所述资源文件的标识从所述应用程序安装包调用资源文件。The second original calling unit is configured to: if the resource file package is read, and the resource file cannot be called from the resource file package according to the identifier of the resource file, then from the resource file package according to the identifier of the resource file The application installation package calls resource files. 8.如权利要求6或7所述的应用程序运行装置,其特征在于,所述资源文件管理装置还包括:8. The application running device according to claim 6 or 7, wherein the resource file management device further comprises: 恢复模块,用于在接收到恢复使用所述应用程序安装包中的资源文件的指令时,删除所述资源文件包。The restoration module is configured to delete the resource file package when receiving an instruction to resume use of the resource file in the application installation package. 9.一种终端,其特征在于,所述终端包括:9. A terminal, characterized in that the terminal comprises: 一个或多个处理器;one or more processors; 存储装置,用于存储一个或多个程序;storage means for storing one or more programs; 当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-5中任一所述的应用程序运行方法。When the one or more programs are executed by the one or more processors, the one or more processors are made to implement the application program running method according to any one of claims 1-5. 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-5中任一所述的应用程序运行方法。10. A computer-readable storage medium, on which a computer program is stored, wherein, when the program is executed by a processor, the application program running method according to any one of claims 1-5 is implemented.
CN201710407242.6A 2017-06-02 2017-06-02 Application program running method and device, terminal and computer readable storage medium Pending CN107168719A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710407242.6A CN107168719A (en) 2017-06-02 2017-06-02 Application program running method and device, terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710407242.6A CN107168719A (en) 2017-06-02 2017-06-02 Application program running method and device, terminal and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN107168719A true CN107168719A (en) 2017-09-15

Family

ID=59824246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710407242.6A Pending CN107168719A (en) 2017-06-02 2017-06-02 Application program running method and device, terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN107168719A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107729148A (en) * 2017-10-13 2018-02-23 郑州云海信息技术有限公司 Method and device for invoking resources
CN107748838A (en) * 2017-10-13 2018-03-02 东软集团股份有限公司 The method, apparatus and storage medium and electronic equipment of installation kit generation
CN108647032A (en) * 2018-03-29 2018-10-12 珠海市魅族科技有限公司 Using loading method and device, computer installation and computer readable storage medium
CN111767063A (en) * 2019-04-02 2020-10-13 青岛海信移动通信技术股份有限公司 Application resource update method, device and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014101504A1 (en) * 2012-12-25 2014-07-03 腾讯科技(深圳)有限公司 Method and device for detecting words in application program
CN104915257A (en) * 2015-06-08 2015-09-16 青岛海信移动通信技术股份有限公司 Method and device for replacing theme based on Android system application
CN105204823A (en) * 2014-05-29 2015-12-30 腾讯科技(深圳)有限公司 Method and device for generating application installation package
CN105630518A (en) * 2014-10-28 2016-06-01 北京娜迦信息科技发展有限公司 Method and device for updating resources of Android application software
CN107885540A (en) * 2016-09-28 2018-04-06 腾讯科技(深圳)有限公司 A kind of method, apparatus and terminal of loading application programs static resource

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014101504A1 (en) * 2012-12-25 2014-07-03 腾讯科技(深圳)有限公司 Method and device for detecting words in application program
CN105204823A (en) * 2014-05-29 2015-12-30 腾讯科技(深圳)有限公司 Method and device for generating application installation package
CN105630518A (en) * 2014-10-28 2016-06-01 北京娜迦信息科技发展有限公司 Method and device for updating resources of Android application software
CN104915257A (en) * 2015-06-08 2015-09-16 青岛海信移动通信技术股份有限公司 Method and device for replacing theme based on Android system application
CN107885540A (en) * 2016-09-28 2018-04-06 腾讯科技(深圳)有限公司 A kind of method, apparatus and terminal of loading application programs static resource

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107729148A (en) * 2017-10-13 2018-02-23 郑州云海信息技术有限公司 Method and device for invoking resources
CN107748838A (en) * 2017-10-13 2018-03-02 东软集团股份有限公司 The method, apparatus and storage medium and electronic equipment of installation kit generation
CN108647032A (en) * 2018-03-29 2018-10-12 珠海市魅族科技有限公司 Using loading method and device, computer installation and computer readable storage medium
CN111767063A (en) * 2019-04-02 2020-10-13 青岛海信移动通信技术股份有限公司 Application resource update method, device and device

Similar Documents

Publication Publication Date Title
CN108491216B (en) A method for Android system non-aware application installation and upgrade
CN109739523B (en) Application packaging method, device, storage medium and terminal
TWI715762B (en) Method and apparatus for creating virtual machine
US8893272B2 (en) Method and device for recombining runtime instruction
CN111045686B (en) Method for improving decompilation speed of application, intelligent terminal and storage medium
CN107168719A (en) Application program running method and device, terminal and computer readable storage medium
CN111352692B (en) Method and system for realizing container mirroring by adopting web language
CN106775781B (en) Method and device for reducing application installation packages and electronic equipment
KR20150022849A (en) Auto-update while running client interface with handshake
CN112882694A (en) Program compiling method and device, electronic equipment and readable storage medium
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
CN115129348A (en) Resource updating method, device and equipment of application program and readable storage medium
CN114490103A (en) Operating system interface calling method, device and electronic device
CN107301347A (en) A kind of method that Hbuilder App calling figures are obtained based on static analysis
US9250917B2 (en) Auto-cloudifying applications via runtime modifications
CN115136133A (en) Single use execution environment for on-demand code execution
CN115374083A (en) Data source switching method, device, electronic device and storage medium
US20140289734A1 (en) Cache management in a multi-threaded environment
WO2025124172A1 (en) Method and apparatus for component deployment and updating, computer device, and storage medium
US10394619B2 (en) Signature-based service manager with dependency checking
CN108376074B (en) RancherOS ros core module transplanting method based on embedded system
CN104391733A (en) Method for dynamically compiling software package according to dependence relationship
CN107016262A (en) Application program right management method and client
US11017032B1 (en) Document recovery utilizing serialized data
KR100803290B1 (en) Scalable virtual machine and program reprogramming method for changing program in wireless sensor network environment

Legal Events

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

Application publication date: 20170915

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载