Introduction to opens the offline package for the first time, the white screen and the error "-1009" are reported, what should I do?

醒目大字娱乐吃瓜公众号首图.jpg

Principle of Offline Package

Take the process of starting an offline package once as an example. The offline package loading process is divided into two scenarios. The first is the scenario where the offline package is downloaded. The process is shown in Figure 1. The second is the scenario where the offline package is not downloaded. ,as shown in picture 2:

1.png

Figure 1: Offline package loading mainstream

2.png

Figure 2: Offline package download process

We can track the specific loading process of the offline package from the buried point*:

  1. Check whether there is an offline package locally. If there is an offline package locally, perform the fourth step of decompression. After decompression, verify it. The verification is done by loading the local offline package. If it has been installed locally, then you do not need to decompress and go directly to the decompression process.
  2. The network requests offline package information. This step and the previous step are performed asynchronously, and the corresponding buried point is H5\_APP\_REQUEST
  3. Compare the offline package information returned by the request, and then decide whether to download the offline package, the corresponding buried point is H5\_APP\_DOWNLOAD
  4. Unzip the offline package, the corresponding buried point is H5\_APP\_UNZIP
  5. If offline package verification is enabled, verify the legitimacy of the offline package. The corresponding embedding points are H5\_APP\_VERIFY, H5\_AL\_SESSION\_VERIFYTAR\_FAIL
  6. Load the local offline package, the corresponding buried points are H5\_AL\_SESSION\_MAP\_SUCCESS, H5\_AL\_SESSION\_FALLBACK

Note: The fallback route needs to wait until the offline package requests this asynchronous request callback and the returned fallback + mainUrl determines the URL opened by the Webview.

*Reference material: offline package log embedding point

Case 1: Open the offline package blank screen for the first time

STEP1: according to the offline package loading process. The first time you open the offline package, you must go online fallback, because there is no local, you must know the online address or URL of the offline package before going online, so you need to check the log Analyze whether there is an error in the step of requesting offline package information.

3.png

4.png

5.png

STEP2: When the analysis log opened the online and offline package, the URL was empty. The offline package was opened before the offline package request was called back, so a white screen appeared.

STEP3: check code

6.png

Taking the created offline package controller as the root view was too early, which caused the problem.

STEP4: combines customer needs to give suggestions, you can use the local pre-made offline package to solve the problem of a white screen when the offline package is opened prematurely for the first time.

Case 2: Open the preset offline package and report an error (-1009)

reproduced demo

STEP1: When fails to open the prefabricated offline package when the network is disconnected, it shows that the network cannot be connected. It means that the prefabricated package failed to open, so it went online. Because there is no network, it shows that the network cannot be connected.

STEP2: that there are two situations in which there are prefabricated packages locally. There are two situations: offline package verification signature failure and local offline package loading failure.

STEP3: log analysis

7.png

It is observed that there is a sign that the verification has failed.

STEP4: checks whether the code client has closed the verification. It is enabled by default. If it is not closed, the client needs to set the corresponding public key or close the verification.

8.png

STEP5: close the verification and try again, continue to analyze the log:

9.png

10.png

11.png

H5\_AL\_SESSION\_FALLBACK failed to load the local offline package, and finally went online. Observe that the offline package was successfully decompressed and there was no problem. The problem was in the step of loading the offline package. An abnormal buried point of the H5\_APP\_EXCEP offline package was found in the log. , It failed to read the data.

: The may appear on the offline package. A normal offline package is provided for the customer to make a local prefabricated offline package, and the network is disconnected to open the verification. If there is no problem, the problem lies in the offline package.

STEP7: unlocks the pre-made offline package, and observes whether the total length of the path characters of the offline package exceeds the limit, which causes the reading of data to fail.

12.png

The name of the JS file is too long, causing the total character length to exceed the limit, requiring the customer to modify the offline package*.

*Reference material: generates offline package

Thinking and summarizing

Through the introduction of the above two cases, we can clearly see that the cause of the problem in case 1 was that the request for offline package information was not called back, and the client did not get the URL when opening the offline package. The problem occurred in requesting the offline package. That step, and case two was finally positioned at the step where loading the local package failed.

After understanding the specific loading process of the offline package, combined with the automatic embedding log of the nebula container, you can specifically locate the problem to which step of the offline package loading.

Author of this article: Alibaba Cloud mPaaS TMA team (Yang Qiang Rongyang)

END


封面图0820.png

Next Tuesday (8.24) Alibaba Cloud Feitian Membership Day will start, and resource packs such as news push will be 10% discount. Click 1612c88ffd29c3 to learn more about the discount.

Copyright Statement: content of this article is contributed spontaneously by Alibaba Cloud real-name registered users. The copyright belongs to the original author. The Alibaba Cloud Developer Community does not own its copyright and does not assume corresponding legal responsibilities. For specific rules, please refer to the "Alibaba Cloud Developer Community User Service Agreement" and the "Alibaba Cloud Developer Community Intellectual Property Protection Guidelines". If you find suspected plagiarism in this community, fill in the infringement complaint form to report it. Once verified, the community will immediately delete the suspected infringing content.

阿里云开发者
3.2k 声望6.3k 粉丝

阿里巴巴官方技术号,关于阿里巴巴经济体的技术创新、实战经验、技术人的成长心得均呈现于此。


引用和评论

0 条评论