WO2019019643A1 - 应用程序热更新方法、装置、终端和存储介质 - Google Patents

应用程序热更新方法、装置、终端和存储介质 Download PDF

Info

Publication number
WO2019019643A1
WO2019019643A1 PCT/CN2018/078315 CN2018078315W WO2019019643A1 WO 2019019643 A1 WO2019019643 A1 WO 2019019643A1 CN 2018078315 W CN2018078315 W CN 2018078315W WO 2019019643 A1 WO2019019643 A1 WO 2019019643A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
new version
update
resource file
version
Prior art date
Application number
PCT/CN2018/078315
Other languages
English (en)
French (fr)
Inventor
潘伟洲
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2019019643A1 publication Critical patent/WO2019019643A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running

Definitions

  • the present application relates to the field of computer technologies, and in particular, to an application hot update method, apparatus, terminal, and storage medium.
  • React Native an open source framework for developing applications based on the JavaScript framework
  • hot updates allow code and resources to be updated without the need for the application to be reinstalled.
  • the working mechanism is to package a series of resources into a bundle file (a resource file package), and the application loads the bundle file to complete the hot update.
  • React Native hot update will package all js files into a bundle file and publish the entire bundle file. If the bundle file fails to load, it may cause the entire application to crash. How to effectively avoid the crash of the entire application during the React Native hot update is a technical problem that needs to be solved.
  • An application hot update method including:
  • the application is started, and the mapping file and the plurality of current version resource file packages are loaded; the business function identifier and the corresponding resource file package identifier are recorded in the mapping file;
  • An application hot update device comprising:
  • a startup module configured to start an application, load a mapping file, and multiple current version resource file packages;
  • the mapping function file records a service function identifier and a corresponding resource file package identifier;
  • a communication module configured to generate a version update request, send the version update request to the server, so that the server queries whether the update file corresponding to the new version exists according to the version update request, and if yes, acquires the update file;
  • a dynamic loading module configured to dynamically load, by using the mapping file, a new version resource file package corresponding to the service function identifier
  • the rollback module is configured to roll back the current version resource file package if it detects that the new version resource file package fails to load.
  • a terminal includes a memory and a processor, wherein the memory stores computer readable instructions, and when the instructions are executed by the processor, the following steps are implemented:
  • mapping function file records a service function identifier and a corresponding resource file package identifier
  • One or more computer readable non-volatile storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the steps of:
  • mapping function file records a service function identifier and a corresponding resource file package identifier
  • the above application hot update method, device, terminal and storage medium can obtain an update file through a version update request when the application performs a React Native hot update, thereby effectively preventing the application from crashing during the React Native hot update.
  • FIG. 1 is an application scenario diagram of an application hot update method in an embodiment
  • Figure 2 is a block diagram of the terminal of Figure 1;
  • FIG. 3 is a flow chart of an application hot update method in an embodiment
  • FIG. 4 is a block diagram of an application hot update apparatus in one embodiment.
  • first may be referred to as a second client
  • second client may be referred to as a first client, without departing from the scope of the present application.
  • Both the first client and the second client are clients, but they are not the same client.
  • the application hot update method provided in the embodiment of the present application can be applied to the application scenario as shown in FIG. 1.
  • the terminal 102 is connected to the server 104 via a network.
  • the terminal 102 has an application installed.
  • the application starts, the base file package, the mapping file, and multiple current version resource file packages are loaded.
  • the application When the application is launched, the application generates a version update request to send a version update request to the server 104 over the network.
  • the server 104 receives the version update request, and queries whether the update text corresponding to the new version exists according to the application identifier and the current version number carried in the version update request. If so, the server 104 acquires the update file corresponding to the new version, and returns the update file to the terminal 102.
  • the terminal 102 receives the new version of the update file by using the application, and dynamically loads the new version resource file package corresponding to the service function identifier by using the mapping file.
  • the terminal 102 loads the new version resource file package by using the application, if a load failure occurs, the new version resource file package is rolled back to the current version resource file package. This effectively prevents the application from crashing and ensures that the application continues to function properly.
  • the terminal includes a processor coupled through a system bus, a non-volatile storage medium, an internal memory and network interface, a display screen, and an input device.
  • the processor of the terminal is used to provide calculation and control capabilities.
  • the memory of the terminal includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium of the terminal stores an operating system and computer readable instructions, the internal memory of the terminal providing an environment for operating the operating system and computer readable instructions in the non-volatile storage medium.
  • the computer readable instructions are executed by the processor to implement an application hot update method.
  • the network interface is used for network communication with the server, such as sending a version update request and receiving an update file returned by the server.
  • the display screen of the terminal may be a liquid crystal display or an electronic ink display screen, and the input device may be a touch layer covered on the display screen, or may be a button, a trackball or a touchpad provided on the terminal housing.
  • the terminal can be a mobile phone, a tablet or a personal digital assistant or a wearable device. It will be understood by those skilled in the art that the structure shown in FIG. 2 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the terminal to which the solution of the present application is applied.
  • the specific terminal may include a ratio. More or fewer components are shown in the figures, or some components are combined, or have different component arrangements.
  • an application hot update method is provided, which is applied to the terminal as an example, and specifically includes the following steps:
  • Step 302 Start an application, load a mapping file, and multiple current version resource file packages; the mapping function records the service function identifier and the corresponding resource file package identifier.
  • Step 304 Generate a version update request, and send a version update request to the server, so that the server queries whether the update file corresponding to the new version exists according to the version update request, and if yes, obtains the update file.
  • Step 306 Receive an update file returned by the server, where the update file includes multiple new version resource file packages, and the new version resource file package has a resource file package identifier.
  • Step 308 Dynamically load a new version resource file package corresponding to the service function identifier by using the mapping file.
  • Step 310 If it is detected that the new version resource file package fails to be loaded, roll back to the current version resource file package.
  • the terminal has an application installed.
  • the base file package, the mapping file, and multiple current version resource file packages are loaded.
  • the base package covers the basic functionality of the application and the public library.
  • the resource file package can be obtained by subcontracting processing according to the business function.
  • Applications can have multiple business functions, such as insurance, financial management, and illegal queries. Different business functions can have different resource file packages.
  • the mapping between the service function identifier and the resource file package identifier is recorded in the mapping file. Different versions of resource files can be identified by the same file.
  • Applications can have multiple versions. After the application is started, the application acquires the application identifier, the current version number, the terminal information, and the like, and generates a version update request by using the application identifier, the current version number, and the terminal information, and sends the version update request to the server.
  • the server receives the version update request, and queries whether the update text corresponding to the new version exists according to the application identifier and the current version number carried in the version update request. If yes, the server obtains an update file corresponding to the new version, and returns the update file to the terminal.
  • the terminal utilizes the application to receive a new version of the update file.
  • the update file can be a compressed file.
  • the terminal uses the application to decompress the update file to obtain multiple and new version resource file packages.
  • the application dynamically loads the new version resource file package corresponding to the business function identifier by using the mapping file.
  • the step of dynamically loading a new version resource file package corresponding to the service function identifier by using the mapping file includes: obtaining a dynamic reference method corresponding to the service function; acquiring a dependency relationship between the multiple service functions; and utilizing the dynamic reference The method and the dependency query the resource file package identifier that needs to be loaded in the mapping file; obtain the new version resource file package according to the queried resource file package identifier, and dynamically load the new version resource file package.
  • the resource file package can be located in the assets directory.
  • the new version resource file package after the packet processing may be replaced with other specified directories, and all new version resource file packages in the specified directory may be flat. Level storage.
  • Each business function can have a corresponding program module, and the corresponding business function is realized by running the program module.
  • the developer can modify the reference method between the program modules corresponding to the multiple business functions during the application development process.
  • the reference method between program modules uses a static reference method. Failure to statically load a resource file package can affect multiple program modules and can even cause an application to crash.
  • the reference method between program modules is modified to a dynamic reference method.
  • the application acquires a dynamic reference method between program modules of multiple business functions, and a dependency relationship between program modules of multiple business functions.
  • the application uses the dynamic reference method and dependencies to query the mapping file for the resource file package identifier to be loaded.
  • the application obtains the resource file package acquisition interface, and the interface can obtain the new version resource file package in the specified directory according to the queried resource file package identifier.
  • This enables multiple new version resource file packages to be dynamically loaded one by one.
  • the terminal can back up through the application's current version resource package.
  • the backup resource file package is obtained, and the new version resource file package is rolled back to the current version resource file package by using the backed up resource file package. Make sure the application continues to function normally.
  • the update file can be obtained through the version update request.
  • the new version resource file package is dynamically loaded by using the mapping relationship between the service function identifier and the resource file package identifier in the mapping file. If a new version of the resource file package fails to load, it can effectively avoid the impact on the program modules of other business functions, thus effectively avoiding the application crash. If a new version of the resource file package fails to load, roll back to the current version resource file package to ensure that the application continues to function normally. This makes it possible to effectively avoid application crashes during React Native hot updates.
  • the new version resource file package can be the patch file of the current version resource file package.
  • the patch file is dynamically loaded by using the mapping file.
  • the hotfix of the application is implemented by merging the loaded patch file with the current version resource file package. Due to the small patch file, it can effectively improve the file transfer speed and speed up the hot update efficiency.
  • mapping file update includes full update and incremental update.
  • the application receives the update file returned by the server, extracts the full-updated mapping file in the update file, loads the fully updated mapping file, and overwrites the local mapping file.
  • the new version of the resource file package is then dynamically loaded using the fully updated mapping file.
  • the mapping file is an incremental update
  • the application receives the update file returned by the server, extracts the incremental update mapping file in the update file, and loads the incrementally updated mapping file.
  • the incrementally updated mapping file is merged with the local mapping file to obtain the updated mapping file.
  • the new version resource file package is dynamically loaded using the updated mapping file. This makes it easy to quickly implement hot updates for your application.
  • the update file includes a new version of the image
  • the method further includes: when the application is started, loading a local transparent picture; when receiving the update file, acquiring an image update path corresponding to the application in the update file According to the image update path, the new version image is updated in the update file; if it exists, the new version image is obtained, and the new version image is used to overwrite the transparent image for image update.
  • the server obtains the corresponding updated picture according to the request.
  • the version update request carries terminal information including a terminal model, a screen size, and a screen resolution.
  • the server obtains the corresponding new version image according to the terminal information, and writes the new version image to the update file.
  • the terminal receives the update file returned by the server.
  • the new version image needs to be loaded.
  • the application When the application starts, it loads the local default transparent image in addition to the base file package, the mapping file, and multiple current version resource file packages.
  • a transparent picture When a transparent picture is loaded, the display effect is that there is currently no content to display.
  • the transparent picture can have a corresponding size, such as 16 x 16 or the like.
  • the terminal After the terminal receives the update file returned by the server, the terminal acquires the image update path in the update file through the application.
  • the application queries the update file according to the image update path to check whether there is a new version of the image. If it exists, the new version image is acquired, and the new version image is loaded to cover the transparent image to implement the image update. If the new version image is not found in the update file according to the update path, the local default image path is obtained, and the current version image is locally queried according to the default image path, and the current version image is loaded to cover the transparent image. If the current picture is not queried locally, the transparent picture continues to be displayed.
  • the update file since the update file only includes the update picture corresponding to the terminal information, it is not required to send all the pictures to the application, which effectively reduces the size of the update file, not only improves the transmission speed of the update file, but also effectively improves The application update efficiency.
  • the method further includes: if the application crashes, identifying a crashed service function, obtaining a corresponding service function identifier; and querying, according to the service function identifier, a corresponding resource file package identifier in the mapping file; The resource file package identifies the fault location where the crash occurred.
  • the terminal may use React Native to identify the crashed business function and obtain the business function.
  • the service function identifier may also be referred to as a crash service function identifier.
  • the terminal uses the React Native call mapping file to query the corresponding resource file package identifier in the mapping file according to the crash service function identifier.
  • the resource file package in which the crash occurred is identified based on the queried resource file package identifier. This makes it possible to quickly and accurately locate the location where the crash occurred, making it easier for developers to fix the application.
  • the current version resource file includes a current version of the bundle file
  • the new version of the resource file includes a patch file corresponding to the new version of the bundle file
  • the method further includes: extracting, in the update file, a first check code corresponding to the new version of the bundle file; merging the patch file with the current version of the bundle file to obtain a merged new version of the bundle file; and calculating a corresponding new version of the bundle file corresponding to the bundled file
  • the second check code is compared with the second check code. If the difference is different, the patch file fails to be loaded, and the merged new version of the bundle file is rolled back to the current version of the bundle file.
  • the React Native hot update may be an incremental hot update.
  • the new version resource package in the update file may be the patch file corresponding to the new version bundle file.
  • the update file also includes the first check code corresponding to the new version of the bundle file.
  • the first check code may be an MD5 (Message-Digest Algorithm 5) value.
  • the patch file corresponding to the new version of the bundle file is dynamically loaded through the mapping file. After the patch file is loaded, it is merged with the corresponding current version of the bundle file to generate a merged new version of the bundle file.
  • the terminal can use React Native to calculate the second check code of the merged new version of the bundle file.
  • the second check code is also an MD5 value.
  • the first check code is compared with the second check code. If the two are the same, the patch file is successfully loaded. If the two are different, the patch file fails to load.
  • the present application further provides an application hot update device
  • the internal structure of the application hot update device may correspond to the structure shown in FIG. 2, and each of the following modules may pass through the software in whole or in part. , hardware or a combination thereof.
  • the application hot update device includes a boot module 402, a communication module 404, a dynamic load module 406, and a rollback module 408, wherein:
  • the startup module 402 is configured to start an application, load a mapping file, and multiple current version resource file packages; the mapping function records the service function identifier and the corresponding resource file package identifier.
  • the communication module 404 is configured to generate a version update request, and send a version update request to the server, so that the server queries whether the update file corresponding to the new version exists according to the version update request, and if yes, obtains the update file; and receives the update file returned by the server.
  • the update file includes multiple new version resource file packages, and the new version resource file package has a resource file package identifier.
  • the dynamic loading module 406 is configured to dynamically load a new version resource file package corresponding to the service function identifier by using the mapping file.
  • the rollback module 408 is configured to roll back the current version resource file package if it detects that the new version resource file package fails to load.
  • the update file includes a new version of the image
  • the startup module 402 is further configured to load a local transparent image when the application is started.
  • the dynamic loading module 406 is further configured to: when the update file is received, acquire the application in the update file.
  • the image update path corresponding to the program ; whether the new version image exists in the update file according to the image update path; if it exists, the new version image is obtained, and the new version image is used to overwrite the transparent image for image update.
  • the dynamic loading module 406 is further configured to obtain a dynamic reference method corresponding to the service function, obtain a dependency relationship between the multiple service functions, and query the resource file to be loaded in the mapping file by using the dynamic reference method and the dependency relationship.
  • the package identifier is obtained.
  • the new version resource file package is obtained according to the queried resource file package identifier, and the new version resource file package is dynamically loaded.
  • the device further includes: a positioning module 410, configured to: if the application crashes, identify a crashed service function, obtain a corresponding service function identifier; and query the corresponding resource file in the mapping file according to the service function identifier.
  • the package identifier locates the fault location where the crash occurs according to the queried resource file package identifier.
  • the current version resource file includes a current version of the bundle file
  • the new version of the resource file includes a patch file corresponding to the new version of the bundle file.
  • the device further includes a verification module 412, configured to extract a new version of the bundle file in the update file.
  • the first check code; the patch file is merged with the current version of the bundle file to obtain a merged new version of the bundle file; the second check code corresponding to the merged new version of the bundle file is calculated; the first check code and The second check code is compared. If the difference is different, the patch file fails to be loaded.
  • the rollback module is also used to roll back the merged new version of the bundle file to the current version of the bundle file.
  • a terminal includes a memory and a processor.
  • the memory stores computer readable instructions.
  • the processor executes the following steps:
  • mapping function file records the business function identifier and the corresponding resource file package identifier
  • the update file includes a plurality of new version resource file packages, and the new version resource file package has a resource file package identifier;
  • the update file includes a new version of the picture
  • the processor performs the following steps when executing the computer readable instructions:
  • the processor also performs the following steps when executing the computer readable instructions:
  • the new version resource file package is obtained according to the queried resource file package identifier, and the new version resource file package is dynamically loaded.
  • the processor also performs the following steps when executing the computer readable instructions:
  • the fault location of the crash is located according to the queried resource file package identifier.
  • the current version resource file includes a current version of the bundle file
  • the new version of the resource file includes a patch file corresponding to the new version of the bundle file
  • the patch file is merged with the current version of the bundle file to obtain a merged new version of the bundle file;
  • the first check code is compared with the second check code. If the difference is different, the patch file fails to be loaded, and the merged new version of the bundle file is rolled back to the current version of the bundle file.
  • one or more computer readable non-volatile storage media having computer readable instructions, when executed by one or more processors, causing one or more processors Perform the following steps:
  • mapping function file records the business function identifier and the corresponding resource file package identifier
  • the update file includes a plurality of new version resource file packages, and the new version resource file package has a resource file package identifier;
  • the update file includes a new version of the picture
  • the computer readable instructions when executed by the processor, also perform the following steps:
  • the computer readable instructions when executed by the processor, also perform the following steps:
  • the new version resource file package is obtained according to the queried resource file package identifier, and the new version resource file package is dynamically loaded.
  • the computer readable instructions when executed by the processor, also perform the following steps:
  • the fault location of the crash is located according to the queried resource file package identifier.
  • the current version resource file includes a current version of the bundle file
  • the new version of the resource file includes a patch file corresponding to the new version of the bundle file
  • the patch file is merged with the current version of the bundle file to obtain a merged new version of the bundle file;
  • the first check code is compared with the second check code. If the difference is different, the patch file fails to be loaded, and the merged new version of the bundle file is rolled back to the current version of the bundle file.
  • the readable storage medium which when executed, may include the flow of an embodiment of the methods as described above.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or the like.

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

一种应用程序热更新方法、装置、终端和存储介质。所述方法包括:启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识(302);生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件(304);接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识(306);利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包(308);若检测到新版本资源文件包加载失败,则向当前资源文件包进行回滚(310)。

Description

应用程序热更新方法、装置、终端和存储介质
本申请申明享有2017年7月26日递交的申请号为201710619237.1、名称为“应用程序热更新方法、装置、终端和存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
技术领域
本申请涉及计算机技术领域,特别是涉及一种应用程序热更新方法、装置、终端和存储介质。
背景技术
React Native(一款基于JavaScript框架来开发应用程序的开源框架)热更新可以在应用程序不需要重新安装的前提下进行代码和资源的更新。其工作机制是通过将一系列资源打包成bundle文件(一种资源文件包),应用程序加载bundle文件,进而完成热更新。在传统的方式中,React Native热更新时会将所有的js文件都打包入一个bundle文件中,将整个bundle文件进行发布。如果bundle文件加载失败,有可能会导致整个应用程序的崩溃。如何在React Native热更新时有效避免整个应用程序的崩溃成为目前需要解决的一个技术问题。
发明内容
基于此,有必要针对上述技术问题,提供一种在React Native热更新时有效避免应用程序出现崩溃情形的应用程序热更新方法、装置、终端和存储介质。
一种应用程序热更新方法,包括:
启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文 件中记录了业务功能标识和对应的资源文件包标识;
生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;
接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
一种应用程序热更新装置,所述装置包括:
启动模块,用于启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识;
通信模块,用于生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
动态加载模块,用于利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
回滚模块,用于若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
一种终端,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时实现以下步骤:
启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识;
生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器 根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;
接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识;
生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;
接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
上述应用程序热更新方法、装置、终端和存储介质,在应用程序进行React Native热更新时,通过版本更新请求可以获得更新文件,实现了在React Native热更新时能够有效避免应用程序的崩溃。
附图说明
图1为一个实施例中应用程序热更新方法的应用场景图;
图2为图1中终端的框图;
图3为一个实施例中应用程序热更新方法的流程图;
图4为一个实施例中应用程序热更新装置的框图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一客户端称为第二客户端,且类似地,可将第二客户端称为第一客户端。第一客户端和第二客户端两者都是客户端,但其不是同一客户端。
本申请实施例中所提供的应用程序热更新方法可以应用于如图1所示的应用场景中。终端102通过网络与服务器104进行连接。终端102安装了应用程序。当应用程序启动时,加载基础文件包、映射文件和多个当前版本资源文件包。当应用程序启动后,应用程序生成版本更新请求,通过网络将版本更新请求发送至服务器104。服务器104接收版本更新请求,根据版本更新请求中所携带的应用程序标识和当前版本号查询是否存在新版本对应的更新文本。若存在,则服务器104获取新版本对应的更新文件,将更新文件返回至终端102。终端102利用应用程序接收新版本的更新文件,利用映射文件动态加载与业务功能标识对应的新版本资源文件包。当终端102利用应用程序加载新版本资源文件包时,如果出现加载失败的情形,将新版本资源文件包向当前版本资源文件包进行回滚。从而能够有效避免应用程序崩溃的情形,确保应用程序能够继续正常运行。
图2为一个实施例中终端的内部框图。如图2所示,该终端包括通过系 统总线连接的处理器、非易失性存储介质、内存储器和网络接口、显示屏和输入装置。其中,终端的处理器用于提供计算和控制能力。该终端的存储器包括非易失性存储介质、内存储器。该终端的非易失性存储介质存储有操作系统和和计算机可读指令,该终端的内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机可读指令被处理器执行时以实现一种应用程序热更新方法。网络接口用于与服务器进行网络通信,如发送版本更新请求以及接收服务器返回的更新文件等。终端的显示屏可以是液晶显示屏或者电子墨水显示屏等,输入装置可以是显示屏上覆盖的触摸层,也可以是终端外壳上设置的按键、轨迹球或触控板等。该终端可以是手机、平板电脑或者个人数字助理或穿戴式设备等。本领域技术人员可以理解,图2中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的终端的限定,具体的终端可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,如图3所示,提供了一种应用程序热更新方法,以该方法应用于终端为例进行说明,具体包括以下步骤:
步骤302,启动应用程序,加载映射文件和多个当前版本资源文件包;映射文件中记录了业务功能标识和对应的资源文件包标识。
步骤304,生成版本更新请求,将版本更新请求发送至服务器;以使得服务器根据版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取更新文件。
步骤306,接收服务器返回的更新文件,更新文件包括多个新版本资源文件包,新版本资源文件包具有资源文件包标识。
步骤308,利用映射文件动态加载与业务功能标识对应的新版本资源文件包。
步骤310,若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
终端安装了应用程序。当应用程序启动时,加载基础文件包、映射文件和多个当前版本资源文件包。基础文件包涉及应用程序的基本功能和公共库。资源文件包可以是按照业务功能进行分包处理得到的。应用程序可以具有多项业务功能,例如,保险、理财以及违章查询等。不同的业务功能可以有不同的资源文件包。映射文件中记录了业务功能标识与资源文件包标识之间的映射关系。不同版本的资源文件包可以采用相同的文件标识。
应用程序可以有多个版本。当应用程序启动后,应用程序获取应用程序标识、当前版本号以及终端信息等,并且利用应用程序标识、当前版本号以及终端信息等生成版本更新请求,将版本更新请求发送至服务器。服务器接收版本更新请求,根据版本更新请求中所携带的应用程序标识和当前版本号查询是否存在新版本对应的更新文本。若存在,则服务器获取新版本对应的更新文件,将更新文件返回至终端。
终端利用应用程序接收新版本的更新文件。更新文件可以是压缩文件。终端利用应用程序对更新文件进行解压缩,得到多个与新版本资源文件包。在对应用程序进行React Native热更新时,为了有效避免因新版本资源文件包加载失败而导致应用程序崩溃的问题,应用程序利用映射文件动态加载与业务功能标识对应的新版本资源文件包。
在其中一个实施例中,利用映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤包括:获取业务功能对应的动态引用方法;获取多个业务功能之间的依赖关系;利用动态引用方法和依赖关系在映射文件中查询需要加载的资源文件包标识;根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
在对应用程序进行React Native热更新时,传统方式中资源文件包可以位于assets目录下。本实施例中,为了便于对多个资源文件包的管理,可以将经过分包处理后的新版本资源文件包更换至其他指定目录,并且在指定目录下所有的新版本资源文件包可以采用平级存放。
每个业务功能可以具有对应的程序模块,通过运行程序模块来实现相应的业务功能。为了便于React Native热更新时能够对新版本资源文件包进行动态加载,开发人员在进行应用程序的开发过程中,可以对多个业务功能对应的程序模块之间的引用方法进行修改。传统的方式中,程序模块之间的引用方法采用静态引用方法。若静态加载资源文件包失败,则会对多个程序模块造成影响,甚至可能会导致应用程序崩溃。
在本实施例中,程序模块之间的引用方法修改为动态引用方法。利用动态引用方法和映射文件加载所需的资源文件包。具体的,应用程序获取多个业务功能的程序模块之间的动态引用方法,以及多个业务功能的程序模块之间的依赖关系。应用程序利用该动态引用方法和依赖关系在映射文件中查询需要加载的资源文件包标识。应用程序获取资源文件包获取接口,利用该接口可以根据查询到的资源文件包标识在指定目录下获取新版本资源文件包。由此实现将多个新版本资源文件包逐一进行动态加载。通过对每个业务功能的新版本资源文件包进行动态加载,若出现某个新版本资源文件包加载失败时,能够有效避免对其他业务功能的程序模块造成影响,从而能够有效避免应用程序崩溃的情形。
在应用程序进行React Native热更新时,终端可以通过应用程序当前版本资源文件包进行备份。当加载新版本资源文件包时,如果出现加载失败的情形,则获取备份后的资源文件包,利用备份后的资源文件包将新版本资源文件包向当前版本资源文件包进行回滚,以此确保应用程序能够继续正常运行。
本实施例中,在应用程序进行React Native热更新时,通过版本更新请求可以获得更新文件。利用映射文件中的业务功能标识和资源文件包标识的映射关系对新版本资源文件包进行动态加载。若出现某个新版本资源文件包加载失败时,能够有效避免对其他业务功能的程序模块造成影响,从而能够有效避免应用程序崩溃的情形。若出现某个新版本资源文件包加载失败,则 向当前版本资源文件包进行回滚,由此确保应用程序能够继续正常运行。从而实现了在React Native热更新时能够有效避免应用程序的崩溃。
进一步的,在进行React Native热更新时,可以采用增量热更新。新版本资源文件包可以是当前版本资源文件包的补丁文件。当应用程序接收到该补丁文件后,利用映射文件对补丁文件进行动态加载。将加载后的补丁文件与当前版本资源文件包进行合并,以此实现对应用程序的热更新。由于补丁文件较小,能够有效提高文件传输速度,加快热更新效率。
进一步的,如果应用程序新增了业务功能,还需要对映射文件进行更新,映射文件更新包括全量更新和增量更新。当映射文件为全量更新时,应用程序接收服务器返回的更新文件,在更新文件中提取全量更新的映射文件,将全量更新的映射文件进行加载,对本地映射文件进行覆盖。然后利用全量更新的映射文件对新版本资源文件包进行动态加载。当映射文件为增量更新时,应用程序接收服务器返回的更新文件,在更新文件中提取增量更新的映射文件,将增量更新的映射文件进行加载。利用增量更新的映射文件与本地映射文件进行合并,得到更新后的映射文件。利用更新后的映射文件对新版本资源文件包进行动态加载。由此方便快捷的实现应用程序的热更新。
在一个实施例中,所述更新文件包括新版本图片,该方法还包括:当应用程序启动时,加载本地的透明图片;当接收到更新文件时,在更新文件获取应用程序对应的图片更新路径;根据图片更新路径查询更新文件中是否存在新版本图片;若存在,则获取新版本图片,利用新版本图片覆盖透明图片进行图片更新。
在传统的方式中,整个资源文件包被静态加载之后,可能会出现图片无法正常渲染,导致图片无法显示的问题。本实施例中,如果新版本中对图片进行了更新,服务器在接收到版本更新请求之后,根据该请求获取相应的更新后的图片。具体的,版本更新请求中携带了包括终端型号、屏幕尺寸和屏幕分辨率等的终端信息。服务器根据终端信息获取对应的新版本图片,将新 版本图片写入更新文件。终端接收到服务器返回的更新文件,除了对新版本资源文件包进行动态加载,还需要对新版本图片进行加载。
应用程序启动时,除了加载基础文件包、映射文件和多个当前版本资源文件包之外,还会加载本地默认的透明图片。当加载透明图片时,显示效果为当前没有内容可显示。透明图片可以具有相应的尺寸,例如16×16等。通过加载透明图片,可以有效防止应用程序的崩溃,并且由于透明图片具有相应的尺寸,可以有效防止页面布局的错乱。
当终端接收到服务器返回的更新文件后,终端通过应用程序在更新文件中获取图片更新路径。应用程序根据图片更新路径在更新文件中查询是否存在新版本图片,若存在,则获取新版本图片,将新版本图片进行加载覆盖透明图片,以实现图片更新。若根据更新路径在更新文件中未查询到新版本图片,则获取本地默认图片路径,根据默认图片路径在本地查询当前版本图片,将当前版本图片进行加载覆盖透明图片。若在本地查询不到当前图片,则继续显示透明图片。在这个过程中,由于更新文件中只包括与终端信息对应的更新图片,不需要向应用程序下发所有的图片,有效减少了更新文件的大小,不仅提高了更新文件的传输速度,而且有效提高了应用程序的更新效率。
在一个实施例中,该方法还包括:若应用程序发生崩溃,识别出现崩溃的业务功能,获取对应的业务功能标识;根据业务功能标识在映射文件中查询对应的资源文件包标识;根据查询到的资源文件包标识对发生崩溃的故障部位进行定位。
本实施例中,在应用程序运行的过程中(包括应用程序的使用过程和热更新过程),如果出现了应用程序崩溃的情形,终端可以利用React Native识别出现崩溃的业务功能,获取该业务功能对应的业务功能标识。该业务功能标识也可以称为崩溃业务功能标识。终端利用React Native调用映射文件,根据崩溃业务功能标识在映射文件中查询对应的资源文件包标识。根据查询到的资源文件包标识识别出发生崩溃的资源文件包。从而能够对发生崩溃的 部位进行快速准确定位,为开发人员对应用程序进行修复提供了方便。
在一个实施例中,当前版本资源文件包括当前版本bundle文件,新版资源文件包括新版本bundle文件对应的补丁文件;在利用映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤之后,还包括:在更新文件中提取新版本bundle文件对应的第一校验码;将补丁文件与当前版本bundle文件进行合并,得到合并后的新版本bundle文件;计算合并后的新版本bundle文件对应的第二校验码;将第一校验码和第二校验码进行比较,若不同,则表示补丁文件加载失败,从合并后的新版本bundle文件回滚至当前版本bundle文件。
本实施例中,React Native热更新可以是增量热更新。更新文件中的新版本资源包可以是新版本bundle文件对应的补丁文件。更新文件中还包括新版本bundle文件对应的第一校验码。例如,第一校验码可以是MD5(Message-Digest Algorithm 5,消息摘要算法第五版)值。
在对应用程序进行增量热更新时,通过映射文件对新版本bundle文件对应的补丁文件进行动态加载。补丁文件加载后与相应的当前版本bundle文件进行合并生成合并后的新版本bundle文件。为了验证补丁文件的加载是否成功,终端可以利用React Native计算合并后的新版本bundle文件的第二校验码。例如,第二校验码也为MD5值。将第一校验码与第二校验码进行比较,如果二者相同,则表示补丁文件加载成功。如果二者不同,则表示补丁文件加载失败。通过对新版本bundle的第一校验码与合并后的新版本bundle文件的第二校验码进行比对,由此能够及时发现补丁文件是否成功加载。
为了防止因补丁文件加载失败而导致应用程序出现崩溃的情形,在确定补丁文件加载失败后,将合并后的新版本bundle文件回滚至当前版本bundle文件,以便确保应用程序能够正常运行。
如图4所示,本申请还提供了一种应用程序热更新装置,该应用程序热更新装置的内部结构可对应于如图2所示的结构,下述每个模块可全部或部 分通过软件、硬件或其组合来实现。在一个实施例中,应用程序热更新装置包括:启动模块402、通信模块404、动态加载模块406和回滚模块408,其中:
启动模块402,用于启动应用程序,加载映射文件和多个当前版本资源文件包;映射文件中记录了业务功能标识和对应的资源文件包标识。通信模块404,用于生成版本更新请求,将版本更新请求发送至服务器;以使得服务器根据版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取更新文件;接收服务器返回的更新文件,更新文件包括多个新版本资源文件包,新版本资源文件包具有资源文件包标识。动态加载模块406,用于利用映射文件动态加载与业务功能标识对应的新版本资源文件包。回滚模块408,用于若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
在一个实施例中,更新文件包括新版本图片,启动模块402还用于当应用程序启动时,加载本地的透明图片;动态加载模块406还用于当接收到更新文件时,在更新文件获取应用程序对应的图片更新路径;根据图片更新路径查询更新文件中是否存在新版本图片;若存在,则获取新版本图片,利用新版本图片覆盖透明图片进行图片更新。
在一个实施例中,动态加载模块406还用于获取业务功能对应的动态引用方法;获取多个业务功能之间的依赖关系;利用动态引用方法和依赖关系在映射文件中查询需要加载的资源文件包标识;根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
在一个实施例中,该装置还包括:定位模块410,用于若应用程序发生崩溃,识别出现崩溃的业务功能,获取对应的业务功能标识;根据业务功能标识在映射文件中查询对应的资源文件包标识;根据查询到的资源文件包标识对发生崩溃的故障部位进行定位。
在一个实施例中,当前版本资源文件包括当前版本bundle文件,新版资 源文件包括新版本bundle文件对应的补丁文件;该装置还包括校验模块412,用于在更新文件中提取新版本bundle文件对应的第一校验码;将补丁文件与当前版本bundle文件进行合并,得到合并后的新版本bundle文件;计算合并后的新版本bundle文件对应的第二校验码;将第一校验码和第二校验码进行比较,若不同,则表示补丁文件加载失败,回滚模块还用于从合并后的新版本bundle文件回滚至当前版本bundle文件。
一种终端,包括存储器及处理器,存储器中储存有计算机可读指令,指令被处理器执行时,使得处理器执行以下步骤:
启动应用程序,加载映射文件和多个当前版本资源文件包;映射文件中记录了业务功能标识和对应的资源文件包标识;
生成版本更新请求,将版本更新请求发送至服务器;以使得服务器根据版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取更新文件;
接收服务器返回的更新文件,更新文件包括多个新版本资源文件包,新版本资源文件包具有资源文件包标识;
利用映射文件动态加载与业务功能标识对应的新版本资源文件包;
若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
在一个实施例中,所述更新文件包括新版本图片,处理器执行计算机可读指令时还执行以下步骤:
当应用程序启动时,加载本地的透明图片;
当接收到更新文件时,在所述更新文件获取应用程序对应的图片更新路径;
根据所述图片更新路径查询所述更新文件中是否存在新版本图片;
若存在,则获取新版本图片,利用所述新版本图片覆盖透明图片进行图片更新。
在一个实施例中,处理器执行计算机可读指令时还执行以下步骤:
获取业务功能对应的动态引用方法;
获取多个业务功能之间的依赖关系;
利用动态引用方法和依赖关系在映射文件中查询需要加载的资源文件包标识;
根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
在一个实施例中,处理器执行计算机可读指令时还执行以下步骤:
若应用程序发生崩溃,识别出现崩溃的业务功能,获取对应的业务功能标识;
根据业务功能标识在映射文件中查询对应的资源文件包标识;
根据查询到的资源文件包标识对发生崩溃的故障部位进行定位。
在一个实施例中,当前版本资源文件包括当前版本bundle文件,新版资源文件包括新版本bundle文件对应的补丁文件;在利用映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤之后,处理器执行计算机可读指令时还执行以下步骤:
在更新文件中提取新版本bundle文件对应的第一校验码;
将补丁文件与当前版本bundle文件进行合并,得到合并后的新版本bundle文件;
计算合并后的新版本bundle文件对应的第二校验码;
将第一校验码和第二校验码进行比较,若不同,则表示补丁文件加载失败,从合并后的新版本bundle文件回滚至当前版本bundle文件。
在一个实施例中,提供了一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
启动应用程序,加载映射文件和多个当前版本资源文件包;映射文件中 记录了业务功能标识和对应的资源文件包标识;
生成版本更新请求,将版本更新请求发送至服务器;以使得服务器根据版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取更新文件;
接收服务器返回的更新文件,更新文件包括多个新版本资源文件包,新版本资源文件包具有资源文件包标识;
利用映射文件动态加载与业务功能标识对应的新版本资源文件包;
若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
在一个实施例中,所述更新文件包括新版本图片,计算机可读指令被处理器执行时还执行以下步骤:
当应用程序启动时,加载本地的透明图片;
当接收到更新文件时,在所述更新文件获取应用程序对应的图片更新路径;
根据所述图片更新路径查询所述更新文件中是否存在新版本图片;
若存在,则获取新版本图片,利用所述新版本图片覆盖透明图片进行图片更新。
在一个实施例中,计算机可读指令被处理器执行时还执行以下步骤:
获取业务功能对应的动态引用方法;
获取多个业务功能之间的依赖关系;
利用动态引用方法和依赖关系在映射文件中查询需要加载的资源文件包标识;
根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
在一个实施例中,计算机可读指令被处理器执行时还执行以下步骤:
若应用程序发生崩溃,识别出现崩溃的业务功能,获取对应的业务功能 标识;
根据业务功能标识在映射文件中查询对应的资源文件包标识;
根据查询到的资源文件包标识对发生崩溃的故障部位进行定位。
在一个实施例中,当前版本资源文件包括当前版本bundle文件,新版资源文件包括新版本bundle文件对应的补丁文件;在利用映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤之后,计算机可读指令被处理器执行时还执行以下步骤:
在更新文件中提取新版本bundle文件对应的第一校验码;
将补丁文件与当前版本bundle文件进行合并,得到合并后的新版本bundle文件;
计算合并后的新版本bundle文件对应的第二校验码;
将第一校验码和第二校验码进行比较,若不同,则表示补丁文件加载失败,从合并后的新版本bundle文件回滚至当前版本bundle文件。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (18)

  1. 一种应用程序热更新方法,包括:
    启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识;
    生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;
    接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
    利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
    若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
  2. 根据权利要求1所述的方法,其特征在于,所述更新文件包括新版本图片,所述方法还包括:
    当应用程序启动时,加载本地的透明图片;
    当接收到更新文件时,在所述更新文件获取应用程序对应的图片更新路径;
    根据所述图片更新路径查询所述更新文件中是否存在新版本图片;
    若存在,则获取新版本图片,利用所述新版本图片覆盖透明图片进行图片更新。
  3. 根据权利要求1所述的方法,其特征在于,所述利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤包括:
    获取业务功能对应的动态引用方法;
    获取多个业务功能之间的依赖关系;
    利用所述动态引用方法和所述依赖关系在映射文件中查询需要加载的 资源文件包标识;
    根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若应用程序发生崩溃,识别出现崩溃的业务功能,获取对应的业务功能标识;
    根据所述业务功能标识在映射文件中查询对应的资源文件包标识;
    根据查询到的资源文件包标识对发生崩溃的故障部位进行定位。
  5. 根据权利要求1所述的方法,其特征在于,所述当前版本资源文件包括当前版本bundle文件,所述新版资源文件包括新版本bundle文件对应的补丁文件;在所述利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤之后,还包括:
    在所述更新文件中提取新版本bundle文件对应的第一校验码;
    将所述补丁文件与当前版本bundle文件进行合并,得到合并后的新版本bundle文件;
    计算所述合并后的新版本bundle文件对应的第二校验码;
    将所述第一校验码和第二校验码进行比较,若不同,则表示所述补丁文件加载失败,从合并后的新版本bundle文件回滚至当前版本bundle文件。
  6. 一种应用程序热更新装置,其特征在于,所述装置包括:
    启动模块,用于启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识;
    通信模块,用于生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
    动态加载模块,用于利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
    回滚模块,用于若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
  7. 根据权利要求6所述的装置,其特征在于,所述更新文件包括新版本图片,所述启动模块还用于当应用程序启动时,加载本地的透明图片;所述动态加载模块还用于当接收到更新文件时,在所述更新文件获取应用程序对应的图片更新路径;根据所述图片更新路径查询所述更新文件中是否存在新版本图片;若存在,则获取新版本图片,利用所述新版本图片覆盖透明图片进行图片更新。
  8. 根据权利要求6所述的方法,其特征在于,所述动态加载模块还用于获取业务功能对应的动态引用方法;获取多个业务功能之间的依赖关系;利用所述动态引用方法和所述依赖关系在映射文件中查询需要加载的资源文件包标识;根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
  9. 一种终端,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时实现以下步骤:
    启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识;
    生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;
    接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
    利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
    若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回 滚。
  10. 根据权利要求1所述的终端,其特征在于,所述更新文件包括新版本图片,所述指令被所述处理器执行时还用于实现以下步骤:
    当应用程序启动时,加载本地的透明图片;
    当接收到更新文件时,在所述更新文件获取应用程序对应的图片更新路径;
    根据所述图片更新路径查询所述更新文件中是否存在新版本图片;
    若存在,则获取新版本图片,利用所述新版本图片覆盖透明图片进行图片更新。
  11. 根据权利要求1所述的终端,其特征在于,所述利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤包括:
    获取业务功能对应的动态引用方法;
    获取多个业务功能之间的依赖关系;
    利用所述动态引用方法和所述依赖关系在映射文件中查询需要加载的资源文件包标识;
    根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
  12. 根据权利要求1所述的终端,其特征在于,所述指令被所述处理器执行时还用于实现以下步骤:
    若应用程序发生崩溃,识别出现崩溃的业务功能,获取对应的业务功能标识;
    根据所述业务功能标识在映射文件中查询对应的资源文件包标识;
    根据查询到的资源文件包标识对发生崩溃的故障部位进行定位。
  13. 根据权利要求1所述的终端,其特征在于,所述当前版本资源文件包括当前版本bundle文件,所述新版资源文件包括新版本bundle文件对应的补丁文件;在所述利用所述映射文件动态加载与业务功能标识对应的新版 本资源文件包的步骤之后,还包括:
    在所述更新文件中提取新版本bundle文件对应的第一校验码;
    将所述补丁文件与当前版本bundle文件进行合并,得到合并后的新版本bundle文件;
    计算所述合并后的新版本bundle文件对应的第二校验码;
    将所述第一校验码和第二校验码进行比较,若不同,则表示所述补丁文件加载失败,从合并后的新版本bundle文件回滚至当前版本bundle文件。
  14. 一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
    启动应用程序,加载映射文件和多个当前版本资源文件包;所述映射文件中记录了业务功能标识和对应的资源文件包标识;
    生成版本更新请求,将所述版本更新请求发送至服务器;以使得服务器根据所述版本更新请求查询是否存在新版本对应的更新文件,若存在,则获取所述更新文件;
    接收服务器返回的更新文件,所述更新文件包括多个新版本资源文件包,所述新版本资源文件包具有所述资源文件包标识;
    利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包;
    若检测到新版本资源文件包加载失败,则向当前版本资源文件包进行回滚。
  15. 根据权利要求14所述的存储介质,其特征在于,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器还执行以下步骤:
    当应用程序启动时,加载本地的透明图片;
    当接收到更新文件时,在所述更新文件获取应用程序对应的图片更新路径;
    根据所述图片更新路径查询所述更新文件中是否存在新版本图片;
    若存在,则获取新版本图片,利用所述新版本图片覆盖透明图片进行图片更新。
  16. 根据权利要求14所述的存储介质,其特征在于,所述利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤包括:
    获取业务功能对应的动态引用方法;
    获取多个业务功能之间的依赖关系;
    利用所述动态引用方法和所述依赖关系在映射文件中查询需要加载的资源文件包标识;
    根据查询到的资源文件包标识获取新版本资源文件包,将新版本资源文件包进行动态加载。
  17. 根据权利要求14所述的存储介质,其特征在于,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器还执行以下步骤:
    若应用程序发生崩溃,识别出现崩溃的业务功能,获取对应的业务功能标识;
    根据所述业务功能标识在映射文件中查询对应的资源文件包标识;
    根据查询到的资源文件包标识对发生崩溃的故障部位进行定位。
  18. 根据权利要求14所述的存储介质,其特征在于,所述当前版本资源文件包括当前版本bundle文件,所述新版资源文件包括新版本bundle文件对应的补丁文件;在所述利用所述映射文件动态加载与业务功能标识对应的新版本资源文件包的步骤之后,还包括:
    在所述更新文件中提取新版本bundle文件对应的第一校验码;
    将所述补丁文件与当前版本bundle文件进行合并,得到合并后的新版本bundle文件;
    计算所述合并后的新版本bundle文件对应的第二校验码;
    将所述第一校验码和第二校验码进行比较,若不同,则表示所述补丁文件加载失败,从合并后的新版本bundle文件回滚至当前版本bundle文件。
PCT/CN2018/078315 2017-07-26 2018-03-07 应用程序热更新方法、装置、终端和存储介质 WO2019019643A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710619237.1A CN107729041B (zh) 2017-07-26 2017-07-26 应用程序热更新方法、装置、终端和存储介质
CN201710619237.1 2017-07-26

Publications (1)

Publication Number Publication Date
WO2019019643A1 true WO2019019643A1 (zh) 2019-01-31

Family

ID=61201727

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/078315 WO2019019643A1 (zh) 2017-07-26 2018-03-07 应用程序热更新方法、装置、终端和存储介质

Country Status (2)

Country Link
CN (1) CN107729041B (zh)
WO (1) WO2019019643A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109976786A (zh) * 2019-03-11 2019-07-05 宸瑞普惠(广州)科技有限公司 移动应用软件的热更新方法、服务器和移动终端
CN110187910A (zh) * 2019-05-30 2019-08-30 腾讯科技(上海)有限公司 一种热更新方法、装置、设备及计算机可读存储介质
CN112988260A (zh) * 2021-01-25 2021-06-18 杭州衣科云科技有限公司 应用冷启动优化方法、装置、计算机设备及存储介质
CN113076128A (zh) * 2020-01-03 2021-07-06 北京猎户星空科技有限公司 用于机器人配置的方法、装置、电子设备及存储介质
CN113448611A (zh) * 2021-08-31 2021-09-28 中邮消费金融有限公司 一种应用程序快速热更新的方法及系统

Families Citing this family (37)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321139B (zh) * 2018-03-29 2023-06-23 阿里巴巴(中国)有限公司 数据管理方法和系统
CN108762800A (zh) * 2018-05-23 2018-11-06 北京五八信息技术有限公司 应用程序的动态更新方法和装置
CN109032631B (zh) * 2018-07-12 2020-12-18 腾讯科技(深圳)有限公司 应用程序补丁包获取方法、装置、计算机设备及存储介质
CN109002314A (zh) * 2018-09-29 2018-12-14 深圳市元征科技股份有限公司 软件更新方法、装置、电子设备及存储介质
CN109343880B (zh) * 2018-09-29 2022-05-13 武汉斗鱼网络科技有限公司 一种rn包更新方法、装置及可读存储介质
CN109491695B (zh) * 2018-10-19 2021-08-06 华南理工大学 一种集成安卓应用的增量更新方法
CN111274433A (zh) * 2018-11-20 2020-06-12 比亚迪股份有限公司 语音资源库的更新方法及装置
CN109783130A (zh) * 2018-12-14 2019-05-21 深圳市创梦天地科技有限公司 一种前端项目的打包方法及服务器
CN109683937A (zh) * 2018-12-26 2019-04-26 斑马网络技术有限公司 更新方法、装置和存储介质
CN109857432B (zh) * 2019-01-14 2022-05-20 珠海金山网络游戏科技有限公司 一种游戏应用的热更新方法和装置
CN111679842B (zh) * 2019-03-11 2023-06-23 阿里巴巴集团控股有限公司 应用程序热更新处理方法、装置及系统
CN109918112B (zh) * 2019-03-15 2022-10-04 网易(杭州)网络有限公司 游戏热更新方法、装置和存储介质
CN109992284A (zh) * 2019-03-29 2019-07-09 北京金山安全软件有限公司 一种热更新程序的提供方法、装置及电子设备
CN110162725A (zh) * 2019-04-10 2019-08-23 浙江口碑网络技术有限公司 在线页面加载方法、装置、存储介质及计算机设备
CN110138833B (zh) * 2019-04-12 2023-05-30 中国平安人寿保险股份有限公司 APP中React Native模块的快速调试方法、装置、介质和设备
CN110096295B (zh) * 2019-05-08 2023-08-08 吉旗(成都)科技有限公司 基于ReactNative的多模块移动应用的热更新方法及系统
CN110278115B (zh) 2019-06-20 2022-11-08 京东方科技集团股份有限公司 热更新方法及装置
CN110262825B (zh) * 2019-06-24 2023-12-05 北京字节跳动网络技术有限公司 热更新方法、装置、电子设备及可读存储介质
CN110286927A (zh) * 2019-06-24 2019-09-27 北京字节跳动网络技术有限公司 Flutter应用的热更新方法、装置及设备
CN110554963B (zh) * 2019-08-26 2023-07-25 北京城市网邻信息技术有限公司 一种应用回滚方法、装置及存储介质
CN110727581B (zh) * 2019-09-06 2024-04-05 网宿科技股份有限公司 崩溃定位方法与电子设备
CN110764815A (zh) * 2019-09-26 2020-02-07 北京网聘咨询有限公司 Web API项目发布方法及装置
CN110727895B (zh) * 2019-10-09 2022-07-22 北京达佳互联信息技术有限公司 一种敏感词发送方法、装置、电子设备及存储介质
US10929122B1 (en) * 2019-10-23 2021-02-23 Microsoft Technology Licensing, Llc Modifying program modules in running applications
CN111090442B (zh) * 2019-11-11 2023-07-14 腾讯音乐娱乐科技(深圳)有限公司 一种应用更新方法、装置和存储介质
CN111338666A (zh) * 2020-02-10 2020-06-26 北京字节跳动网络技术有限公司 一种实现应用程序升级的方法、装置、介质和电子设备
CN111368242B (zh) * 2020-03-09 2022-07-08 思必驰科技股份有限公司 语义资源发布系统及方法和自然语言处理装置及方法
CN113495737B (zh) * 2020-04-01 2024-05-03 腾讯科技(深圳)有限公司 一种软件更新方法及相关设备
CN111694582A (zh) * 2020-04-28 2020-09-22 中国平安人寿保险股份有限公司 应用程序资源包的处理方法、装置、设备及可读存储介质
CN112256295A (zh) * 2020-09-21 2021-01-22 北京达佳互联信息技术有限公司 应用程序的更新方法、装置、设备和存储介质
CN112363717B (zh) * 2020-10-29 2024-01-12 福建联迪商用设备有限公司 一种单个软件中加载不同功能的方法及终端
CN112486520A (zh) * 2020-12-07 2021-03-12 深圳市欢太科技有限公司 应用程序升级方法及其装置、移动终端和服务器
CN112596772A (zh) * 2020-12-15 2021-04-02 上海米哈游网络科技股份有限公司 服务器更新方法、装置、电子设备和存储介质
CN112783522B (zh) * 2020-12-28 2022-08-09 北京五八信息技术有限公司 文件的加载方法、文件的加载装置及电子设备
CN113656107A (zh) * 2021-08-23 2021-11-16 天津中新智冠信息技术有限公司 移动应用的加载方法、装置及电子设备
CN113961269A (zh) * 2021-10-22 2022-01-21 深圳依时货拉拉科技有限公司 应用程序的运行控制方法及装置、计算机设备及存储介质
CN114466026B (zh) * 2022-01-05 2024-05-14 杭州网易云音乐科技有限公司 应用程序接口的更新方法、装置、存储介质和计算设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260209A (zh) * 2015-10-20 2016-01-20 珠海金山网络游戏科技有限公司 一种程序热更新解决方法
CN105677415A (zh) * 2016-01-06 2016-06-15 网易(杭州)网络有限公司 热更新方法及装置
CN106059844A (zh) * 2016-08-17 2016-10-26 洑云龙 一种客户端热更新方法
CN106789249A (zh) * 2016-12-22 2017-05-31 北京五八信息技术有限公司 热更新方法、客户端及服务器

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
BR112014012772A8 (pt) * 2011-12-01 2017-06-20 Tencent Tech Shenzhen Co Ltd método e sistema para aprimorar software

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260209A (zh) * 2015-10-20 2016-01-20 珠海金山网络游戏科技有限公司 一种程序热更新解决方法
CN105677415A (zh) * 2016-01-06 2016-06-15 网易(杭州)网络有限公司 热更新方法及装置
CN106059844A (zh) * 2016-08-17 2016-10-26 洑云龙 一种客户端热更新方法
CN106789249A (zh) * 2016-12-22 2017-05-31 北京五八信息技术有限公司 热更新方法、客户端及服务器

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109976786A (zh) * 2019-03-11 2019-07-05 宸瑞普惠(广州)科技有限公司 移动应用软件的热更新方法、服务器和移动终端
CN110187910A (zh) * 2019-05-30 2019-08-30 腾讯科技(上海)有限公司 一种热更新方法、装置、设备及计算机可读存储介质
CN110187910B (zh) * 2019-05-30 2023-09-05 腾讯科技(上海)有限公司 一种热更新方法、装置、设备及计算机可读存储介质
CN113076128A (zh) * 2020-01-03 2021-07-06 北京猎户星空科技有限公司 用于机器人配置的方法、装置、电子设备及存储介质
CN113076128B (zh) * 2020-01-03 2023-11-10 北京猎户星空科技有限公司 用于机器人配置的方法、装置、电子设备及存储介质
CN112988260A (zh) * 2021-01-25 2021-06-18 杭州衣科云科技有限公司 应用冷启动优化方法、装置、计算机设备及存储介质
CN113448611A (zh) * 2021-08-31 2021-09-28 中邮消费金融有限公司 一种应用程序快速热更新的方法及系统
CN113448611B (zh) * 2021-08-31 2021-11-30 中邮消费金融有限公司 一种应用程序快速热更新的方法及系统

Also Published As

Publication number Publication date
CN107729041B (zh) 2020-10-20
CN107729041A (zh) 2018-02-23

Similar Documents

Publication Publication Date Title
WO2019019643A1 (zh) 应用程序热更新方法、装置、终端和存储介质
US9436556B2 (en) Customizable storage system for virtual databases
US8495609B2 (en) Methods, systems, and computer program products for taking a snapshot of installed software on a data processing system as part of a software update process
EP2751662B1 (en) Method for an efficient application disaster recovery
WO2019019668A1 (zh) 应用程序启动方法、装置、计算机设备和存储介质
US20170177452A1 (en) Computing device replication using file system change detection methods and systems
WO2022111097A1 (zh) 一种文件更新方法及装置、设备、存储介质
US11409614B2 (en) Systems and methods for multiple recovery types using single backup type
CN113419766B (zh) 智能更新程序逻辑的方法、装置、设备及存储介质
US11507473B2 (en) System and method for efficient backup generation
US20130067447A1 (en) State Machine Based Package Installation
US10558528B2 (en) Reconstruction of system definitional and state information
CN116339908A (zh) 虚拟机启动方法、装置、计算机设备和存储介质
WO2022083190A1 (zh) 数据下载方法、装置、计算机设备和存储介质
US11720450B2 (en) Virtual machine file retrieval from data store
CN114201207A (zh) 一种资源同步方法、装置、电子设备及存储介质
CN108259613B (zh) 容灾数据的在线同步装置、方法及计算机可读存储介质
CN112596954A (zh) 数据备份及重建方法、装置、设备及存储介质
US11720345B2 (en) Pull based inner-loop code deployment
US11966723B2 (en) Automatic management of applications in a containerized environment
US20230143903A1 (en) Method and system for idempotent synthetic full backups in storage devices
US11704043B1 (en) Backup and/or restore as a service
US20230074216A1 (en) System and method for preserving access control lists in storage devices
US20230229566A1 (en) Methods and systems of scanning for resources for resource classification in a multi cloud environment
US20220342686A1 (en) Virtual machine file management using file-level snapshots

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18838595

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18838595

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28.05.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18838595

Country of ref document: EP

Kind code of ref document: A1