All Products
Search
Document Center

Generate offline packages

Last Updated: Mar 24, 2021

Based on different requirements, you can encapsulate and package different businesses into an offline package, and then distribute the package through the release platform to update the client-side resource. Generating an offline package mainly includes the following 2 steps:

  1. Build a frontend .zip package
  2. Generate an .amr package online

Build a frontend .zip package

The path in the resource package varies by the package type:

  • Global resource package
  • Normal resource package
Note :
  • Global resource package and normal resource package cannot coexist in the same HTML5 offline package.
  • Offline package ID (namely the Top-level directory below) must be 8 digits.

Global resource package

You can place the common resource which is referenced by other normal resource packages in the global resource package. It is required to specify the resource path within the package with following rules:

  • Top-level directory: Offline package ID, for example: 77777777.
  • Second-level directory: The server’s domain address that is accessible to the resource.
    • For public cloud: It is fixed to mcube-prod.oss-cn-hangzhou.aliyuncs.com (You can see the relevant information in Resource package type of Offline package management > Add an offline package page).
    • For private cloud: Refer to the domain address of mdsweb server deployed in the private cloud.
  • Third-level directory: appId_workspaceId, for example: 53E5279071442_test. Avoid using special characters in folder names, file names, and files for public resource files. Special characters are characters that will be converted by the urlencode function.
  • What follows the third-level directory is your custom public resource.
    Note : For private cloud, you need to add /mcube after the second-level directory (server domain name) of the resource file path.

Example:

  • In public cloud, the second-level directory is fixed to mcube-prod.oss-cn-hangzhou.aliyuncs.com, thus the path of the resource file common.js in the following figure is https://mcube-prod.oss-cn-hangzhou.aliyuncs.com/53E5279071442_test/common.js.path
  • In private cloud, the second-level directory is the domain name of the mdsweb server deployed in private cloud. Taking mdsweb-outer.alipay.net as an example, the path of the resource file common.js in the following figure is https://mdsweb-outer.alipay.net/mcube/53E5279071442_test/common.js.path
Note:
  • The absolute length of the public resource cannot exceed 100 characters, otherwise the client might fail to load the resource and the page goes blank.
  • The server does not control the global resource package version. You can customize the version by adding a file directory structure after the third-level directory according to actual needs.
  • In private cloud, if the file storage format used by the server is hdfs or afs, you need to add a directory before the third-level directory mentioned above. The new directory name is the name of the storage space (bucket) in the mdsweb server.
  • Reference to public resources: The contents of public resource packages in general offline packages must be accessed via absolute paths, such as https://mcube-prod.oss-cn-hangzhou.aliyuncs.com/53E5279071442_test/common.js. ccc

Normal resource package

You can place the relevant frontend resources such as HTML, CSS, and JavaScript into an offline package based on your business. The directory structure is as follows:

  • Top-level directory: Offline package ID, for example: 20171228.
  • Second-level and the following directories are your custom public resource. It is best to save all frontend files in a /www directory, and set a main entry file, for example: /www/index.html.

Generate the .zip package

After configuring the path of resource package, you can directly compress the whole directory where the appId is located into a .zip package.

structure

Generate an .amr package on line

Log in to the mPaaS console, navigate to Mobile Delivery Service > Offline package management, and upload the .zip package generated in the previous step to the Mobile Delivery Service platform to generate a .amr package. For detailed steps, see Mobile Delivery Service > Create offline packages.

Important:
  • In the configuration when creating an offline package, for iOS cilent, the Minimum version under Client range needs to be lower than the Product Version field (see the figure below) in the info.plist file of the iOS client. You are recommended to set Minimum version of iOS client to 1.0.0.
  • The Product Version in the info.plist file should be consistent with the value of Bundle versions string, short, otherwise the offline package may not take effect.

plist1